Sorting out corrupted files.
Go to solution
Solved by rich1187,
17 hours ago, Bittenfleax said:Many hours later:
forfiles /m *.pdf /c "cmd /c echo. & echo @path & pdfinfo.exe @file 1>@fname.txt 2>&1 & findstr /N "Syntax" @fname.txt && (echo File corrupted... Moving... & del @fname.txt & move "@path" "Corrupted") || (echo File not corrupted... Keeping... & del @fname.txt)" 1>Files.txt 2>&1 pauseJust put the pdinfo.exe and this batch file in the SAME folder with all of the PDF's. And also create a folder in there called "Corrupted". Then run this.
I tried this with a Working and Broken PDF. It separated them both and create a log file of what happened which is nice.
Thank you!!! I couldn't use this batch straight away, because the PDF's were not all in one folder, but in sub folders, so i used the command listed below to copy all the pdf's in one folder and then used your batch to sort them. I can't thank You enough, really, thanks!!
for /r %%p in (*.pdf) do copy %%p C:/*Destinationfolder

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now