Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-04-2004, 11:35 AM   #1
Registered: Oct 2004
Posts: 52

Rep: Reputation: 15
File Test to make sure files aren't corrupt/damaged

Are there any unix commands to check the integrity of files?

There is a directory with nearly 50 files and you must copy them from the source to a destination but when you goto copy them it begins copying up to the first 100MB and then hangs resulting in a CTRL + C to cancel. And then you go directly to the last file that it stopped copying and you try to pull it over manually but it will not go because it's damaged/corrupt. Now you know that there are atleast 10 files out of these 100MB that are corrupt and you don't really want to sit there and have to copy all over again and when you do get to the next damaged file you bypass it and start copying everything over again. Now I didn't mention that when you copy you're only able to copy everything in one shot and those files that are damaged you add to en exclude file. So basically you'll sit there for hours waiting and waiting and then wam* you get hit with a screen that is stuck on one file so now you have to cancel the copy and add that filename to the exclude list.

Solution to this would be to create or find a file integrity checker that can check each file in a directory to make sure they aren't damaged/corrupt.

Now does anyone happen to know of the command to test a file for erroneous bytes that will cause it not to be accessable or used? I'm trying to figure out which command can do this.
Old 11-04-2004, 11:44 AM   #2
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
There's no such thing as "erroneous bytes that will cause it not to be accessable". A file copy program doesn't care about the contents of a file. It just reads one stream of bytes and writes to another.

You can, however, easily check to see if two files match with the md5sum command.

itsme@itsme:~/C$ md5sum help.c
b1bf3ee1168d587996f21fa27127f21a help.c
Then, after I copy the file I can run md5sum on the new file and make sure the sums match.

I'm not sure why your copy operation is freezing up, but it shouldn't have anything to do with the contents of the file itself. Maybe a device became unavailable?
Old 11-04-2004, 11:50 AM   #3
Registered: Oct 2004
Posts: 52

Original Poster
Rep: Reputation: 15

That was just the scenario. Here is what i'm really doing sorry I should have said this a long time ago:

I'm trying to recover everything my JAZ 2GB by tarring it to my hda. Ok it's creating fine and then all of a sudden it gets to a file and it stops copying and begins to keep trying to copy the file over and over and i check the size on the tar and it stops growing. I then next just tried copying over the file directly to my hd and it copied almost 50% and began locking up and trying to copy over again and again. So I have to cancel and exclude the file because it's not going anywhere.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba and corrupt files Wordan Linux - Networking 4 11-05-2004 06:51 AM
File test to make sure files aren't damaged/corrupt bluedevlx Linux - Newbie 1 11-04-2004 12:11 PM
Looking for file system that won't corrupt files on hard reboot haimeltjnfg Linux - Software 13 05-30-2004 07:19 PM
I cannot make rox open a +x file as normal files codec Linux - Software 1 05-02-2004 06:04 AM
Passwd files corrupt - I am locked out. Need Help!!! cloy Linux - Newbie 4 02-16-2001 04:25 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration