PC Review


Reply
Thread Tools Rate Thread

Detecting files that won't open

 
 
hharry
Guest
Posts: n/a
 
      12th Oct 2008
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting which form was open Dom Sinclair Microsoft Dot NET Framework Forms 2 2nd Apr 2008 07:37 AM
detecting open worksheet in open work book windsurferLA Microsoft Excel Programming 3 14th Oct 2007 08:45 PM
Detecting if a window is already open (MDI app) Mitchell Vincent Microsoft VB .NET 2 12th May 2005 03:44 PM
Detecting open files R Avery Microsoft Excel Programming 2 5th Jan 2004 05:25 PM
Detecting non-supported files using Excel.Open omyek@yahoo.com Microsoft Excel Programming 0 29th Oct 2003 11:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:43 AM.