Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

question re: Move

Apr
1,825
17
>move /a:-d /n:e /md /r /s *.txt \ZZ_Documents\TXT\

In the command above, if there are no TXT files in a folder below the current one, (e.g. .\Sample\) after the move operation is finished - there will be a \ZZ_Documents\Sample\ folder that will be empty. I know I can use DEL /a:d /s /e /x /y \ZZ_Documents\ to remove empty folders but is there a switch for MOVE to not make empty folders in the destination tree?
 
>move /a:-d /n:e /md /r /s *.txt \ZZ_Documents\TXT\

In the command above, if there are no TXT files in a folder below the current one, (e.g. .\Sample\) after the move operation is finished - there will be a \ZZ_Documents\Sample\ folder that will be empty. I know I can use DEL /a:d /s /e /x /y \ZZ_Documents\ to remove empty folders but is there a switch for MOVE to not make empty folders in the destination tree?
Try /sx instead /s ... means:

move /a:-d /n:e /md /r /sx *.txt \ZZ_Documents\TXT\
 
/SX means "
Move the subdirectory tree to a single target directory (implies /S). MOVE will remove empty subdirectories after the move."

If there are TXT files in .\Sample1\ and .\Sample3\ but none in .\Sample2\ then I want \ZZ_Documents\Sample1\ and \ZZ_Documents\Sample3\ to exist but \ZZ_Documents\Sample2\ not to exist.
 
Okay, I understand NOW and yep, then my example does not work.

I think, it's not possible then to avoid the empty "Sample2" DIR with the move command itself.

It's probably really the best to add the related del command right after the move sequence, like this:

move /a:-d /n:e /md /r /s *.txt \ZZ_Documents\TXT\ & DEL /a:d /s /e /x /y \ZZ_Documents\

Unfortunately for move is no /F like in copy ...

copy /a:-d /n:e /f /md /r /s *.txt \ZZ_Documents\TXT\
 
Last edited:
Back
Top
[FOX] Ultimate Translator
Translate