1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Move /s sorce target

Discussion in 'Support' started by Charles G, Mar 10, 2014.

  1. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,018
    Likes Received:
    0
    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.....
     
  2. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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.
     
  3. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,018
    Likes Received:
    0
    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?
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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.
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,855
    Likes Received:
    83
    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.
     
  6. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,018
    Likes Received:
    0
    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?
     
  7. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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.
     
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,855
    Likes Received:
    83
    Because the third process would have to recurse through the entire subdirectory tree to see if there are any matches in the subdirectories.
     
  9. Rodolfo

    Joined:
    May 20, 2009
    Messages:
    213
    Likes Received:
    0
    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
     
  10. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,301
    Likes Received:
    39
    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.
     
  11. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,018
    Likes Received:
    0
    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.
     
  12. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Go ahead and use the "feedback" mechanism to make the suggestion. Just don't be surprised if the time penalty is heavy.
     
  13. Charles G

    Joined:
    Apr 2, 2011
    Messages:
    1,018
    Likes Received:
    0
    Steve - what do you mean by " time penalty" ??
     
  14. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    What Rex stated - slowed down MOVE to remove empty directories.
     

Share This Page