Detecting files that won't open

Tech-Archive recommends: Fix windows errors by optimizing your registry



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


.



Relevant Pages

  • Re: Change how Word opens .TXT files
    ... allows me to batch send the files to the virtual printer. ... automate this process as much as possible. ... Is there a way to change how Word opens and formats a .txt file? ... I recommend you use a plaintext editor like PFE ...
    (microsoft.public.word.conversions)
  • Re: Change how Word opens .TXT files
    ... As I have lots of these files to convert, and I want to automate this ... Word automatically formats plain text files when it opens them. ... Is there a way to change how Word opens and formats a .txt file? ...
    (microsoft.public.word.conversions)
  • Re: Management Studio - Open File
    ... If you find out how to automate this, ... > The query window I am working in has no idea what file it came from (ie. ... >>> try to open a file managment studio opens it into a new tab, ... >>> into my current window without changing all my connection info. ...
    (microsoft.public.sqlserver.tools)
  • Re: automatic mail-merge to saved document
    ... See the "Individual Merge Letters" item on fellow MVP Graham Mayor's website ... If you are using Word XP or later, the "Add-in to Merge Letters to Separate ... What I'd like to do is automate the process so that the user ... What I would like to happen is when the user opens notice1.doc, ...
    (microsoft.public.word.mailmerge.fields)
  • find: files *created* before a specified time ???
    ... I need to automate the deletion of files in a specified directory that ... To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org ...
    (Debian-User)