Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Scripts to create encrypted backups to online services' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Scripts to create encrypted backups to online services
Authored by: pxb on Oct 16, '07 02:42:00PM

Just a quick update on the resource fork issue. From my research, it looks like resource forks aren't all that common any more, but it'd still be nice to (a) know if you need to back them up, (b) back them if you need to or think you may need this information in the future

Personally I'm using a local external drive as my main backup, and the online backup as an emergency second-level solution. Hopefully I'll never need to use the online backup. My aim is to backup my photos, emails, dev work etc. If I lose the thumbnail preview on my photos or some file permissions that's not the end of the world. As long as the important data is saved.

Anyway, I edited a bash script I found online (unfortunately I can't remember where I found the script, so can't credit the author properly - apologies for that), which will search for resource forks in any of the files for a given directory:

#!/bin/bash
find $1 | while read file
do
# pipe errors of ls to /dev/null to hide errors from calling this on directories without forks (throws No such file or directory error)
FILE_INFO=`ls -l "$file"/rsrc 2>/dev/null`
# if the size of the rsrc is 0, then no fork exists
FILE_SIZE=`echo "$FILE_INFO" | cut -f 9 -d " "`
if [[ $FILE_SIZE -ne "0" ]]; then
# show the size of the fork and the file it is attached to
echo $FILE_SIZE $file
fi
done

save that as an executable file findresforks.bash, and run as something like:

findresforks.bash /Users/Bob/Desktop

and it'll give the size and name of any file with a resource fork. I ran it over my mail directory (~/Library/Mail) and it only found 1 file with a resource fork (~Library/Mail//Bundles/Letterbox.mailbundle/Icon), which is a plugin for Mail.app. Given I'm interested in saving my emails, I don't really care if that plugin's Icon gets lost.

Running the same command across my photos gave quite a few files, which I'm guessing from the file size of each (50-80k) would be thumbnails, which I wouldn't miss really.

You can test this with:

echo 12345 > test.txt
echo 1234567890 > test.txt/rsrc

Which should give a 6 byte data fork and 11 byte resource fork. Running the above script on the directory with test.txt in it should give something like:

11 ./test.txt



[ Reply to This | # ]