Move/Copy switch not make empty destination sub-folders

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
The problem is that it's difficult to know ahead of time which ones will be empty. Consider recursion, advanced wildcards, ranges.... You kind of have to create directories which don't exist as you go.

I would suggest a different approach. Remember the names of all directories which are created, say in a linked list. Then, after the COPY or MOVE finishes, try to remove all of them — in reverse order, inside-out. Newly created directories which are still empty will be removed. Newly created directories which are not still empty will fail, but that's okay; just silently ignore the error and carry on.
Similar threads
Thread starter Title Forum Replies Date
C switch to remove empty folders on Copy/move/etc Suggestions 0
C Declined Add switch to MOVE to not make empty destination folders. (COPY's /F) Suggestions 4
R Copy and Move with auto date/timestamp Suggestions 4
rconn New parameter /WTF - COPY/MOVE - Wait on disk full (rather than halt with error) Suggestions 1
S Done COPY and MOVE Suggestions 0
S Declined Enhanced @FILE for COPY, DESCRIBE, MOVE, RENAME, SYNC, TOUCH /R Suggestions 0
D Done Suggestion for commands to move/copy a folder Suggestions 7
nickles Make move rename conflicting files Suggestions 0
fpefpe Done move like unix mv Suggestions 11
S Done MOVE /k Suggestions 4
E Done move @unquote, @unquotes in help docs Suggestions 0
samintz Done Support ~ and :path in COPY Suggestions 5
Alpengreis Done Preserves directory attributes for COPYDIR & COPY Suggestions 3
D Duplicate directory path and copy files and subdirectories. Suggestions 4
C Feature Request: Gain some elements of the XXCOPY feature set in COPY or a new "Mass-Copy" command Suggestions 0
R Declined wish-list: add a command to copy a file to clipboard. Suggestions 17
D Done Suggestion: keystroke to copy previous argument Suggestions 3
R Done IDE copy (OR REMOVE) Set var name to Watch list by hotkey Suggestions 2
Alpengreis Done Add "Slow copy" (/WAIT) parameter to SYNC command Suggestions 1
C Declined copy /w suggestion Suggestions 2
WinLanEm Done COPY modify Suggestions 4
rconn Done Copy with Backup Versions Suggestions 0
Roedy Declined Copy to DVD Suggestions 2
wbiebel Done copy /u /s Suggestions 1
D Done TCEdit and BDEBUGGER: add cmdline switch to jump to given line Suggestions 2
Peter Murschall Done Redirection Switch ANSI / UNICODE Suggestions 2
A Change /S (/B) switch behavior Suggestions 11
Joe Caverly Declined PSHELL switch for 32- or 64-bit Suggestions 2
rps Done New scrput switch and ini directive Suggestions 0
R Done Switch between TCC and RT on same PC Suggestions 1
ehab aboudaya Done Shortcut Key to switch between current active tab & command input Suggestions 0
S Done Enhanced CASE values in SWITCH Suggestions 29
vefatica Done SWITCH enhancement? Suggestions 13

Similar threads