|1: if exist "%%~na.pdf, %%~na.acc, %%~na.pro" (|
As far as I know, this doesn't work - syntactically not supported, and it's not necessary anyway. (why test for the existance of files before moving them? If the file is not existant, it won't get moved anyhow.)
2: for /f %%a in (*.tif) do
I believe you'er confused here. The intention does not call for the "/f" clause in the "for" statement.
3: it's a matter of personal preference, but I prefer to use a single variable for long paths. It makes the batch more readable, easier to debug, and easier to modify (if you wanted to alter the path, f/e, you only need to alter one location, not multiple).
Analysis of intent: all tif-matching PDFs to "pending", all tifs and tif-matching ACCS and PROs to "done".
Bearing all this in consideration, here's my spin:
::======== begin batch re-write
set base1=P:\1_Previous Batch\Batch_20140811\PROD\PDF
:: not sure what path you intended. Making assumptions which might be wrong
for /f %%a in ('dir /b *.tif') do (
move /-y %source%\%%~na.pdf %pdf_pending% 2>nul
move /-y %source%\%%~na.pro %done% 2>nul
move /-y %source%\%%~na.acc %done% 2>nujl
move /-y %source%\%%~na.tif %done%
::---------- end batch
I used "for /f" with "dir /b *.tif", instead of simply "for %%a in (*.tif)"to dodge a potential recursive implosion, or whatever you call it when you alter directory contents which are the basis of a loop. The "2>nul" sends any errors into the void, instead of cluttering your screen for any non-existant files.