Reputation: 15
For example
Where did folder3 go?
edit 1: it's supposed that within folder3 pre-exist folder4, folder5 and folder6.
edit 2: Here's what I'm trying... robocopy /move /s /e "%1" "D:\library"
edit 3: Registry code
edit 4: Expected context menu in W10.
Upvotes: 0
Views: 6362
Reputation: 4430
The basic syntax of the Robocopy command is
robocopy
source-directory destination-directory [pattern...] [options]
If no pattern is given, the default pattern is *.*
.
The querent probably said something like
robocopy C:\folder1\folder2\folder3 D:\library /move /s /e
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^
source directory destination options
This command tells RoboCopy to move all (the default pattern in *.*
) the files and directories it finds in C:\folder1\folder2\folder3
to D:\library
. Robocopy did that as expected.
To move the directory folder3
from C:\folder1\folder2
to D:\library
, the command is
robocopy C:\folder1\folder2\folder3 D:\library\folder3 /move /e
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^
source directory destination options
Robocopy will create the destination directory D:\library\folder3
if needed. Note that the option /e
implies /s
.
Since the question appears to refer to how to do it in batch file, and assuming that %1
does not end in a backslash, I suggest to replace robocopy /move /s /e "%1" "D:\library"
with
robocopy /move /s /e "%1" "D:\library\%~nx1"
Upvotes: 4
Reputation: 781
The /MOVE
option deleted the source folder, folder3 in this case, after copying to the new destination.
I see you are using both /s
and /e
. I think you may want to simplify your command and choose either /s
, which will not copy empty directories, or /e
which WILL copy empty directories.
Upvotes: 0