I am going to post the steps to use launchd folder watching to automatically strip the resource forks from a known Drop folder on the Desktop, leave the stripped files in a second folder, and then empty the Drop folder. This prevents the script from re-stripping all the files in the Drop folder every time more photos are added to it.
First, create the two folders on the Desktop. I will call them PhotoDropBox and StrippedPhotos.
Second, if there is no folder in /Users/Youracct/Library called LaunchAgents, create that folder there.
Next, write the script:
1. Make a new TextEdit document.
2. Choose "Make Plain Text" from the Format menu.
3. Copy and paste these lines into the document:
Code:
#! /bin/bash
echo $(date) "StripResourceForks begun." >>/dev/console
ditto -V --norsrc ~/Desktop/PhotoDropBox/ ~/Desktop/StrippedPhotos/
rm ~/Desktop/PhotoDropBox/*
echo $(date) "StripResourceForks completed." >>/dev/console
Next, save the script from TextEdit to the /Users/Youracct/Library/Scripts folder. Give it the name StripResourceForks (TextEdit will add the ".txt" extension).
In Terminal, make the script file executable:
chmod +x ~/Library/Scripts/StripResourceForks.txt
Next, download Lingon from sourceforge.net:
http://lingon.sourceforge.net/
This is a utility that makes configuring a launchd folder watch a breeze.
Launch Lingon and set the following:
1. From File, select New.
2. Click the "My Agents" button in the dialog box. Click Create.
3. In the Basic tab of the next dialog, type a label: com.adamr.stripresourceforks would be fine (any name that is unique is OK)
4. Check the "On Demand" checkbox.
5. In the "Program" text box, type "/Users/Youracct/Library/Scripts/StripResourceForks.txt", without quotes and substituting your Home folder name for "Youracct".
6. Click the Paths tab at the top of the window.
7. In the WatchPaths box, type /Users/Youracct/Desktop/PhotoDropBox .
8. Click the Save and Reload button at the bottom.
9. For good measure, click Reload and then quit Lingon.
That's it. You now have a plist file in your Library/LaunchAgents folder that tells launchd to watch the folder PhotoDropBox on the Desktop and to run the script ~/Library/Scripts/StripResourceForks.txt whenever items are added to that folder. The script ~/Library/Scripts/StripResourceForks.txt will use the ditto command to strip the resource forks for all files that are in the folder, move the stripped files to the StrippedPhotos folder, and then delete all of the files in the PhotoDropBox folder.
Drop some photos into PhotoDropBox and make sure that they get moved to the StrippedPhotos folder. If they don't, post here.