Verify that files are in working condition

February 13, 2011 at 03:37:59
Specs: Windows 7
Is there a way to verify that each data file on a partition actually works? I'm not thinking of executables -- asking particularly about data files (e.g., PDFs, JPGs, DOCs). In other words, I am wondering if there is a way to batch process all of the PDFs in a drive or directory, to insure that they will actually open in a program like Acrobat without errors.

See More: Verify that files are in working condition

Report •

February 13, 2011 at 20:11:05
Windows 7 batch test pdf

Report •

February 14, 2011 at 02:59:27
What, write a batch file? With what commands?

Report •

February 14, 2011 at 05:01:50
It's very easy to list all files with certain suffixes, but checking their working integrity, as opposed to their filesystem integrity, is another matter. If you have known working versions you could test for identicalness against them via a syncing program. Other than that, I suppose you would have to actually open each file.

Report •

Related Solutions

February 14, 2011 at 06:42:04
I was afraid of that.

OK. In that case, I know how to open a file on the command line. Is there a command that would then close the file? I'm thinking I'll run a batch file that works through a DIR listing, one file at a time, and I'll send the output to a text file that I can review.

Report •

February 14, 2011 at 08:20:26
Try something like

for /f "tokens=*" %%a IN ('dir /b *.txt') do call notepad.exe %%a

Watch out for html quote marks here. You can add a /s to include subfolders. I don't know offhand how to parse through listings in a file.

Report •

February 14, 2011 at 08:42:06
I think that will open Notepad but not close it, no?

I'll do DIR *.* /s > dirlist.txt to get a listing. I'll put it into Excel and parse it to produce a bazillion commands like this:

start "" C:\Whatever\winword.exe "D:\Foldername\Filename.doc" >> log.txt

But then I'll want a command to close that file or, I guess, kill winword.

Now I'm realizing that if the file doesn't open in Word, the error message will appear in the form of a Word dialog. It won't be repeated on the command line, so the log won't show a problem.

Maybe there's a way to use some commandline macro tool to do this?

Report •

February 14, 2011 at 09:26:36
Either dos or vba. you would want a FOR loop, preferably to draw from a source file. Open each item, add an errorlevel that you pipe to an error.log , pause while it opened, and then kill the process. That might work.

Report •

February 14, 2011 at 09:45:35
Thanks. Some of those steps are new to me. I'll have to try to figure out how to do them. And meanwhile stay tuned here, in case of follow-up suggestions that get me closer to the endpoint.

Report •

Ask Question