I’ve been getting problems now and again with files copying to our server but corrupting. They look like they have copied ok, but when you try to open the files they don’t work. This doesn’t happen all the time but i would like to place a check in my scripts to stop or alert me that the file may have been corrupted.
I have looked into the ‘cksum’ command in shell script that checks the file before and after it has been copied, but can’t get that to work with my scripts…
I was wondering if any body knows a simple command that can check a file has been copied completely and correctly?
Do the files that get corrupted occasionally have anything in common? Are they all of a type?
What is the operating system of the server?
what Adam said, plus please describe your method for opening the files and how you’ve determined that they don’t work–in other words, when do you give up?
you may want to go into a bit of description about the server also. is this AFP, SMB, or some other filesharing protocal that you are using? you could just be losing a resource fork or something. how do the file sizes compare?
Thanks for the replies…
The original problem was that for one of our workflows, we duplicated an artpro file and renamed it within a folder and moved it across to another server to go through a process. The file would corrupt before it would copy to it’s destination, and would not open (no matter what you tried - changing file extensions, restarts etc.)- I changed the script so it would copy the file to the server and rename the file on the fly using shellscript.
All the files that corrupt are artpro files… since the script has been amended there hasn’t been any corrupt files that i know of - i just wanted to put a kind of ‘safety net’ to catch out any file that may slip through our system and cause problems later…
Thank you for help
I would suggest to do a md5 checksum test on both the original and the duplicate using
set a to [your path to filename]
set b to (POSIX path of a) as string
set c to do shell script "md5 '" & b & "'"