Suggestion for commands to move/copy a folder

#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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,575
46
Albuquerque, NM
prospero.unm.edu
#2
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.
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
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.
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
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
 
#6
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
 
May 29, 2008
529
3
Groton, CT
#7
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.

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