Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done Suggestion for commands to move/copy a folder

Jun
770
6
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.
 
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.
 
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.
 
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
 
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
 
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
 
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

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?
 

Similar threads

Back
Top