I have tried the move script but this will only move .pdf files from one folder. I need to move the pdf files from multiple folders witrh different names. I want the script to search for subfolders under "c:\temp\archive\pdf" and copy the folder names and move the pdf files to an archive folder
*.*.pdf doesn't do anything
use folder\ on target so you don't accidentally move a folder and overwrite the old one containing all the pdfs, if a folder name happens to match your source filename
Code:
for %%f in ("c:\temp\pdf\*") do move /-y "c:\temp\pdf\%%~nf\*.pdf" "c:\temp\archive\pdf\%%~nf\"
this does it for every folder under c:\temp\pdf\
~n strips the path from the variable so it's only the local name
http://ss64.com/nt/syntax-args.html
Code:
for %%f in (1 2 3 4 5) do move /-y "c:\temp\pdf\%%f\*.pdf" "c:\temp\archive\pdf\%%f\"
this will work for your specific case
essentially it's the same as above, but the list is generated manually as numbers
if you need to add folder creation for the archive in the generic example you can do this
Code:
for %%f in ("c:\temp\pdf\*") do (
mkdir "c:\temp\archive\pdf\%%~nf"
move /-y "c:\temp\pdf\%%~nf\*.pdf" "c:\temp\archive\pdf\%%~nf\")
i think the batch fails if the closing ) is alone on the last row, which is annoying for a programmer who likes things tidy
just something to keep in mind
Signature/Avatar nuking: none (can be changed in your profile)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum