Scenario: Let’s copy all files from the
d:\vacation snaps\2016 folder and sub-folders to the
d:\all snaps folder recursively.
- Open a Command Prompt window.
- Run the following commands one by one and press ENTER after each line:
md "d:\all snaps" cd /d "d:\vacation snaps\2016" for /r %d in (*) do copy "%d" "d:\all snaps\"
This recursively copies all files in the
d:\vacation snaps\2016\ folder to the
d:\all snaps\ folder. To move the files, replace
If a file of the same name exists in the destination, you’ll be asked if you want to overwrite or skip the file.
Note: It’s always safe to include the trailing backslash (
\) after the destination folder path, as in the above example. Because, without the trailing slash, if the destination path is missing and you run the command, then the files in the folder and subfolders are copied and combined into one single file named
all snaps to