Move /s sorce target

Apr 2, 2011
1,439
10
54
North Carolina, USA
v16.00.43 x64

MOVE /s source\*.ext target\

may create empty folders in target\ is there are folders inside source\ that do not contain *.ext files. I looked at both the MOVE /? and the CHM help - but there doesn't seem to be a switch for MOVE not to make empty folders. I thought there was in a pre v16 version? If it's been removed I'll make the suggestion (in the correct place) to add it back.....
 
May 20, 2008
3,515
4
Elkridge, MD, USA
I think you have received the world famous DWIM parser, since I have not found build 43 available yet...
And yes, the feature you are looking for is one of the few distinctions between COPY and MOVE. Only COPY has the /F option, which, under limited circumstances, does not create empty subdirectories. It only worked when the source and target are local.
 
Apr 2, 2011
1,439
10
54
North Carolina, USA
Guess the 43 was a typo. Haven't been sleeping well lately. Anyway - any reasoning behind MOVE not having a "do not create empty subdirectories" option?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
I suppose I never needed it. I Based on the issues with COPY creating empty subdirectories despite using /F I'd just use
*del/eqxyzs/njt
which deletes orphans, in any. Feel free to use FEEDBACK if you wish.
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
MOVE has never supported that.

In order for MOVE to do it, it would need to preprocess the entire list first (doubling the amount of time required), because it has no way of knowing whether there are going to be any matches in the subdirectory (or its subdirectories) until it actually processes them. This would involve a lot of development effort, and since nobody has been clamoring for it, the effort has gone into developing a few dozen other new features instead.

You can submit it to the feedback forum; if there's a clamor to make MOVE slower I'll consider it for a future version.
 
Apr 2, 2011
1,439
10
54
North Carolina, USA
Rex,

Does MOVE /s

- make each subfolder
- move source files to target folder

then go on to the next subfolder? Why not just add a 3rd process that would basically see if the folder has any non dot files/subfolders then remove it if it doesn't?
 
May 20, 2008
3,515
4
Elkridge, MD, USA
There are two different methods used for MOVE:
1/ moving source to target on the volume;
2/ moving from one dislk volume to another.
For #1 the source is renamed to be the target, whether or not any files are moved. For #2 all must be copied, followed by deleting the source. However, I doubt that first empty trees are ever created before starting to move files.

Regardless, your method differs from postprocessing using *del/eqxyzs/njt only in using a 3rd process, which requires continuous synchronizing, causing slowing down.
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
Does MOVE /s

- make each subfolder
- move source files to target folder

then go on to the next subfolder? Why not just add a 3rd process that would basically see if the folder has any non dot files/subfolders then remove it if it doesn't?

Because the third process would have to recurse through the entire subdirectory tree to see if there are any matches in the subdirectories.
 
May 20, 2009
293
5
57
ITALY
Because the third process would have to recurse through the entire subdirectory tree to see if there are any matches in the subdirectories.
Just my two stupid cents.
And what about if move command builds the target directory structure only if/when it needs it?
In the source there is the following situation.
Code:
A\
A\B\
A\B\C\
A\D\
A\D\E\
A\D\E\FILE.TXT
I type "move /S source\*.txt target\".
The move command goes into directory A, nothing to move, so it does not create anything in target and writes "A\" into an internal variable, and keeps track that in A there are other folders that it will have to check.
Then it goes into directory B, again no file, so the internal variable becomes "A\B\". But it still has to remember that it will have to go back to "A".
When it goes into directory C, it realizes that there are no files, so it can jump back to A, and it has not created nothing.
Then it does roughly the same for D, the internal variable has become "A\D\".
When it reaches E, it finds a file, so it knows that in the target it has to create "A\D" and then inside it "E", where it move the file.
Just a quick and dirty and stupid idea.


Regards

Rodolfo Giovanninetti
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,460
88
Albuquerque, NM
prospero.unm.edu
It's actually pretty easy to delete empty directories yourself:
DEL /S /E /X /Q /Z D:\DIR\CON.*

This command deletes files named CON.* and deletes empty directories under D:\DIR. Since you won't actually have any such files -- that's an illegal filename under Windows -- the end result is just to remove the empties.
 
Apr 2, 2011
1,439
10
54
North Carolina, USA
Just seems illogical to create directories when 1) I don't want them to be empty ones, and 2) to do another command to remove the just made empty ones.
 
Similar threads
Thread starter Title Forum Replies Date
C question re: Move Support 3
samintz MOVE and Prompt on overwrite Support 3
M MOVE does not behaves like intended (on failure) Support 1
kb6ojs Make /G parameter persistent in COPY/MOVE command? Support 4
F Regexes in REN/MOVE/… commands seem to not work at all Support 3
T How to? Off screen move? Support 3
fpefpe Documentation copy/move using /c or /u Support 2
W Recursive move aborts early Support 2
C b21 MOVE /B Support 8
D How move cursor out of popup edit control after no match? Support 14
nickles Move takecommand.18.0.key location to installation directory Support 4
J junction copy/move handling Support 6
J WAD move /s regression from tcc15 Support 5
C move /F Support 4
vefatica MOVE anomaly Support 8
Stefano Piccardi b32 move /Q writes message Support 1
C How to? MOVE and handling out of space Support 2
Joe Caverly How to? Move Window Between Monitors Support 6
S How to? Move files older than one year Support 9
fpefpe move /g Support 4
C Move /MD not always working Support 1
C Move question with Encrypted file... Support 6
W /g option (%) on MOVE cmd appears broken TCC 14.03.57 x64 Support 8
G Fixed MOVE truncates files Support 9
C MOVE making empty destinatation sub-folders Support 10
thedave Move files, inherit permissions Support 14
A Discrepancy in handling of "can't copy or move file to itself" Support 4
A expected behavior of move /sx Support 14
S MOVE from FTP directory to another FTP directory - bug?? Support 2
J directory tree - move or copy Support 3
D MOVE Help typo Support 3
D Suggest Help mention /n no effect in move /n Dir1 Dir2 Support 0
D Move /v to DVD fails but files identical Support 4
S Conditionally MOVE/COPY files on the basis of size Support 1
S MOVE to different drive Support 3
Joe Caverly Move Buttons Between Tabbed Toolbars Support 2
S Another 4NT 8.02 vs TCC 9.02 diff - MOVE command Support 3
S MOVE command over FTP with 4NT 5.00U Support 0
D When copying/moving, appending " (2)" to filename when the target file already exist. Support 7
A Installer /extract: extracts into current directory if target not exists Support 12
vefatica Job handle in target app Support 4
M How to? Get both path to and target of symbolic link/junction... Support 2
Phileosophos COPY /W does not delete files in the target Support 4
K iftp script copy deletes target files Support 17

Similar threads