Done Suggestion for commands to move/copy a folder

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
4,446
88
Albuquerque, NM
prospero.unm.edu
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.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
 
May 20, 2008
3,515
4
Elkridge, MD, USA
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
566
4
Groton, CT
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
 
Similar threads
Thread starter Title Forum Replies Date
Charles Dye Done HASH suggestion for v27 Suggestions 6
Charles Dye Done ASSOCIATE suggestion for v27 Suggestions 1
D Suggestion: VIEW option to open VIEW over tab window but not keep it there Suggestions 0
Alpengreis Done Suggestion for full osbuild internal variable Suggestions 2
L Done Suggestion for TCC 'ver' command Suggestions 8
D Done Suggestion: Add VIEW option to open in same position as current window Suggestions 0
D Suggestion: Tab or button to open new tab window in horizontal group Suggestions 1
Charles Dye @VERINFO suggestion Suggestions 0
D Done Suggestion: keystroke to copy previous argument Suggestions 3
H Done DEDUPE suggestion Suggestions 8
C Done Help suggestion TCMD Suggestions 3
C Declined copy /w suggestion Suggestions 2
J Done Everything Search Suggestion Suggestions 8
Fross Done sendmail suggestion Suggestions 1
K_Meinhard Declined Renewed suggestion Suggestions 0
S Declined TAIL suggestion Suggestions 0
A Done Cosmetic suggestion on displaying version number Suggestions 0
M Done TC 11 suggestion Suggestions 0
G Done V11 Suggestion Suggestions 3
J Done Suggestion for V11 Suggestions 8
Charles Dye Done v11 suggestion: plugin online help interface Suggestions 0
J Done Variable Name Completion Suggestion Suggestions 0
Charles Dye Done Startup Tabs / Tab Toolbar suggestion Suggestions 1
R Add Custom Message to commands Suggestions 2
R Done Watching commands executed and variables changed Suggestions 1
Joe Caverly Done File completion for LIBRARY commands Suggestions 1
R Declined TESTPAUSE and TESTECHO commands for debugging & minor changes Suggestions 9
WinLanEm Add commands and functions Suggestions 11
S Declined Interruption of commands Suggestions 18
S Done Enhanced ALIAS, SET, ESET and FUNCTION commands Suggestions 0
S Declined Add /W(ipe) option to several commands Suggestions 17
S Declined MONITOR commands; several @WIN...[] functions Suggestions 2
S Done Window positioning commands and current position function Suggestions 0
S Done Accessing count results from various commands Suggestions 1
C Done commands report nb_processed + nb_failed Suggestions 4
C Declined Add switch to MOVE to not make empty destination folders. (COPY's /F) Suggestions 4
C Move/Copy switch not make empty destination sub-folders Suggestions 6
R Copy and Move with auto date/timestamp Suggestions 4
rconn New parameter /WTF - COPY/MOVE - Wait on disk full (rather than halt with error) Suggestions 1
nickles Make move rename conflicting files Suggestions 0
fpefpe Done move like unix mv Suggestions 11
S Done MOVE /k Suggestions 4
S Done COPY and MOVE Suggestions 0
S Declined Enhanced @FILE for COPY, DESCRIBE, MOVE, RENAME, SYNC, TOUCH /R Suggestions 0
E Done move @unquote, @unquotes in help docs Suggestions 0

Similar threads