- Feb
- 240
- 3
Here's the case. I have a folder (folder1) containing a few folders (folder2, folder3), each with a few files, and I'd like to bring all of the files into folder1. The command for this is of course:
move /sx *.* .
This command works, but there were two surprises:
1] In addition to moving the files, "move /sx" also deleted the subfolders (folder2, folder3). This does make sense, but it is not what I expected from a move command (the documentation for move /sx doesn't mention anything about this).
The illogic of this behavior comes to the fore when moving only some files. With folder2 and folder3 both containing some .txt files and some .doc files, I executed the following:
move /sx *.txt .
After moving the files, TCC reports:
"removing folder2", and "removing folder3"
Obviously, it does not actually remove these folders, because there are .doc files left in them. But the fact that it reports that it is attempting to remove them seems problematic, since the user certainly does not want that to happen in this case.
2] With the same scenario, but with some files in the root folder (folder1) as well, I ran the command:
move /sx *.* .
Here the command refused to budge, aborting with a message that it cannot move a file onto itself. And here I have two questions:
2a] I understand why it reports this error, but I would have expected it to continue anyway with the rest of the files. Is there any way to tell MOVE to ignore such errors and continue with the next file, rather than aborting?
2b] I worked around the problem by running:
move /S+1 /SX *.* .
However, here I found something weird. If I tried to move just the .txt files, with:
move /S+1 /SX *.txt .
It didn't work at all, reporting "0 files moved".
That is, with identical directory structures, and with a few .txt files and .doc in the subfolders, the command "move /s+1 /sx *.txt" did not succeed in moving any .txt files, but "move /s+1 /sx *.* ." did succeed in moving all of the files, including the .txt files. Why should this be?
move /sx *.* .
This command works, but there were two surprises:
1] In addition to moving the files, "move /sx" also deleted the subfolders (folder2, folder3). This does make sense, but it is not what I expected from a move command (the documentation for move /sx doesn't mention anything about this).
The illogic of this behavior comes to the fore when moving only some files. With folder2 and folder3 both containing some .txt files and some .doc files, I executed the following:
move /sx *.txt .
After moving the files, TCC reports:
"removing folder2", and "removing folder3"
Obviously, it does not actually remove these folders, because there are .doc files left in them. But the fact that it reports that it is attempting to remove them seems problematic, since the user certainly does not want that to happen in this case.
2] With the same scenario, but with some files in the root folder (folder1) as well, I ran the command:
move /sx *.* .
Here the command refused to budge, aborting with a message that it cannot move a file onto itself. And here I have two questions:
2a] I understand why it reports this error, but I would have expected it to continue anyway with the rest of the files. Is there any way to tell MOVE to ignore such errors and continue with the next file, rather than aborting?
2b] I worked around the problem by running:
move /S+1 /SX *.* .
However, here I found something weird. If I tried to move just the .txt files, with:
move /S+1 /SX *.txt .
It didn't work at all, reporting "0 files moved".
That is, with identical directory structures, and with a few .txt files and .doc in the subfolders, the command "move /s+1 /sx *.txt" did not succeed in moving any .txt files, but "move /s+1 /sx *.* ." did succeed in moving all of the files, including the .txt files. Why should this be?