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

Suggestion for commands to move/copy a folder

Discussion in 'Suggestions' started by David Marcus, Feb 11, 2009.

  1. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    I would like commands to move and copy a folder and its contents to another location. For example, if I have folders

    c:\Foo
    c:\Bar

    then I could do something like

    c:\>movefolder Foo Bar

    and the result would be that c:\Foo would be gone, c:\Bar\Foo would now exist, and whatever had been in c:\Foo would now be in c:\Bar\Foo. I'd also like to be able to do

    c:\Foo>movefolder * c:\Bar

    to move all the folders and their contents that are in c:\Foo\ to c:\Bar\.

    This is easy to do using Windows Explorer.
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Provided they're both on the same drive, you can actually do this near-instantaneously with REN:

    Code:
    ren /s c:\Foo c:\Bar\*
    
    If they are on different drives, though, this trick won't work; you'll need to use MOVE instead.
     
  3. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    Well, I'll be. I'm sure I looked at ren, but never tried that syntax. It would be good if the help gave an example of using /s.
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    David Marcus wrote:
    | ---Quote (Originally by Charles Dye)---
    | Provided they're both on the same drive, you can actually do this
    | near-instantaneously with REN:
    |
    |
    | Code:
    | ---------
    | ren /s c:\Foo c:\Bar\*
    | ---------
    | If they are on different drives, though, this trick won't work;
    | you'll need to use MOVE instead. ---End Quote---
    | Well, I'll be. I'm sure I looked at ren, but never tried that syntax.
    | It would be good if the help gave an example of using /s.

    Alternate method:

    ren c:\Foo c:\Bar\Foo

    --
    HTH, Steve
     
  5. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    I don't want to have to retype the name. For longer names, retyping the name is cumbersome and error prone.
     
  6. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    David Marcus wrote:
    | ---Quote (Originally by Steve Fábián)---
    | Alternate method:
    |
    | ren c:\Foo c:\Bar\Foo
    | ---End Quote---
    | I don't want to have to retype the name. For longer names, retyping
    | the name is cumbersome and error prone.

    I can appreciate that. In many instances, when it is unavoidable (usually
    with commands other than RENAME) I use the TAB key to get C:\Bar\ in the
    command line, press space, use TAB to get Foo\ into the line, ctrl-left to
    reposition the cursor, and Bksp to delete the space to get the desired
    C:\Bar\Foo\ (or usu. much longer strings) into the command line without
    error.
    --
    Steve
     
  7. dcantor

    Joined:
    May 29, 2008
    Messages:
    508
    Likes Received:
    3

    MOVE FOO BAR

    did exactly that for me. I did:

    MKDIR FOO
    MKDIR BAR
    ECHO. > FOO\X.TMP
    MOVE FOO BAR

    and I ended up with no FOO directory, and the file
    BAR\FOO\X.TMP
     
  8. David Marcus

    Joined:
    Jun 4, 2008
    Messages:
    649
    Likes Received:
    1
    So it does. Wildcards work too if you use /s. Anyone know whether this has worked in previous versions or is it a new feature?
     

Share This Page