Folder c:\folder1
contains subfolder1
, subfolder2
, etc..
These subdirectories hold .pdf
and .db
files.
How can all the .pdf
files be moved to c:\folder1
using the Windows command interpreter?
Folder c:\folder1
contains subfolder1
, subfolder2
, etc..
These subdirectories hold .pdf
and .db
files.
How can all the .pdf
files be moved to c:\folder1
using the Windows command interpreter?
Robocopy did wonders for me:
I used it to move all files with certain mask out of
c:\cache
and its numerous subdirectories.This worked for me:
This command will copy recursively al pdf files from source to target directory using cmd in windows 7 - tested and works.
Hope it helps.
The outer for loop lists the sub-directories in the working directory, the inner for loop lists the sub-directories to move to the destination path:
This works best if
DestinationPath
is not a subfolder of the working directory, as it will try to moveDestinationPath
into itself.To confirm the command before running it wholesale, start out just echoing the final move commands like so:
and copy/paste one of the results to run it and confirm it worked the way you expected. Then remove the echo and get moving.