Detecting files that won't open
- From: hharry <paulquigley@xxxxxxx>
- Date: Sun, 12 Oct 2008 14:06:16 -0700 (PDT)
Hello All,
Does anyone know of a method to automatically detect if a file is
corrupted ?
Due to a failed backup process a number of files were corrupted. The
files are mostly .xls, .doc, .pdf. When you try to open the file, a
dialog box opens stating that the file cannot be opened.
I need to log which files wont open properly, and I'm hoping there is
a way to automate the process.
I've tried using a streamreader to read the contents of the file,
hoping that an exception would be thrown if the file could not
properly be opened...this didn't work.
I've tried opening the file using the Process and ProcessStartInfo
classes, hoping that an exception would be thrown if the file did not
open correctly..this didn't work
The best I've come up with is a console app, which opens each file in
a specified directory, one-at-a-time, pauses for 10 seconds, and then
prompts the user to enter Y for corrupted or N for okay. Files which
elicit a Y response are logged as corrupted.
This approach requires user-input and ideally, I'd like to completely
automate the process. i.e, specifiy a directory and then press go and
read the log when the program completes.
Any ideas appreciated
.
- Follow-Ups:
- Re: Detecting files that won't open
- From: Peter Duniho
- Re: Detecting files that won't open
- Prev by Date: Re: Midi Close
- Next by Date: webservice running on server with http port 8888 : Could not download wsdl files.
- Previous by thread: Midi Close
- Next by thread: Re: Detecting files that won't open
- Index(es):
Relevant Pages
|