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?
You can use the DIR command by itself (just type “dir” at the Command Prompt) to list the files and folders in the current directory.
This worked for me:
.bat
/ .cmd
file:for /r "c:\source_directory\" %%x in (*.pdf) do move "%%x" "c:\target_directory\"
for /r "c:\source_directory\" %x in (*.pdf) do move "%x" "c:\target_directory\"
This command will copy recursively all *.pdf
files from the source (and all of its subdirectories) to the target directory.
To exclude files in subdirectories omit the /r
switch.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With