Use 'find' to locate corrupted files

Oct 05, '05 06:03:00AM

Contributed by: Anonymous

I had a problem. When I tried to Sync with my .Mac account, it would give me an error message. I found a log file in ~/Library/Logs/Sync called dotmacsync.log that said that some archive was corrupted, but it did not give me a path. So I waited for a while and then did this (from the Terminal) from my home directory:

 $ find . ! -type d -amin -1 -print 2> /dev/null > /tmp/F
/tmp/F will be empty if the machine has been idle for a while. Now I went through the process to produce the error message and redid the command. The command finds all files which are not directories which have been accessed within the past minute. After the second find, /tmp/F had about five files in it. A few were plist files that seemed to be trashed. I created a folder called ~/OLD and moved all the files listed in /tmp/F there. They were pref files and a few files used for sync. I didn't know which one was bad, so I just moved all of them.

In my case, the sync process was clobbering my Keychain. So I had to do "Keychain First Aid" on my keychain to make it OK again. Then I re-did the sync with my .Mac account. At this point, since a lot of the prefs were gone, the sync process thought this was my first time to sync. This gave me the option to replace what was on my machine with what was on my .Mac account. I did that, and now my Keychain and my sync process all seem to be in good shape.

But, really the point of this article is the find comnand mentioned above. It can be used to find what files are being accessed during a particular process to narrow down those that may be corrupted. Good luck!

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20051001164608750