tkthelpdesk
asked on
Need a script or batch file to move PDF files
I have thousand of PDF files in a folder, I know of a few hundred I need, I need a script where I can tell the script what .pdf files I need form the folder and it will dump them to a separate folder.
What are the criteria for selection?
Need specific detail. What filename patterns or dates, if any?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The files are all named with the same pattern of which is a date followed by an underscore and then a number: Example 01232014_12345678.pdf some numbers are longer such as 01232014_123456789.pdf and some shorter such as 01232014_12345.pdf
I have a list of certain ones I need to pull out and drop in a separate folder but I am not so fortunate that they would be sequential. It would take me days to pluck them one by one
I have a list of certain ones I need to pull out and drop in a separate folder but I am not so fortunate that they would be sequential. It would take me days to pluck them one by one
Just rename your list file to select.txt, as shown by Bill, on line 4
Make sure your list has just the file names without the folder prefixes.
Make sure your list has just the file names without the folder prefixes.
A simplified version of Bill's:
@echo off
setlocal EnableDelayedExpansion
set SelectFile=select.txt
set BaseDir=B:\EE\EE28930873\from
set DestDir=B:\EE\EE28930873\to
for /f "usebackq tokens=*" %%A in ("%SelectFile%") do if exist "%%A" ECHO copy "%BaseDir%\%%A" "%DestDir%"