Q:

Finding corrupted files

I have a directory that have zillions of files. As soon as I try to copy this directory, I receive a message that a file could not be copied (corrupt ?) and the copy stops. 
Is there any command I can type on terminal that can check all files on that directory tree and list all files that could not be copied or that are corrupt? I would not like to copy the files at this time, just to check if files would not be possible to copy/read if I try.
I am on OS X Mountain Lion but any unix command should work fine, I hope.
thanks.
NOTE: by corrupt I mean a file that cannot be read or copied.

A:

rsync can be used to copy directories, and is capable of restarting the copy from the point at which it terminated if any error causes the rsync to die.
Using rsync's --dry-run option you can see what would be copied without actually copying anything.  The --stats and --progress options would also be useful.  and --human-readable or -h is easier to read.
e.g.
rsync --dry-run -avh --stats --progress /path/to/src/ /path/to/destination/
I'm not sure if rsync is installed by default on Mac OS X, but I have used it on Macs so I know it's definitely available.
For a quick-and-dirty check on whether files in a subdirectory can be read or not, you could use grep -r XXX /path/to/directory/ > /dev/null.  The search regexp doesn't matter, because output is being discarded anyway.
STDOUT is being redirected to /dev/null, so you'll only see errors.
The only reason I chose grep here was because of its -r recursion option.  There are many other commands that could be used instead of grep here, and even more if used with find.

