PDA

View Full Version : "Find" command and Applescript




GimmeSlack12
Sep 14, 2008, 11:22 PM
Ok this one has stumped me. I want to run an shell script within an Applescript.

do shell script "find ~/Downloads \( -type f -name "*.torrent" \) -exec cp {} ~/Torrents \;"


This is to filter out any torrents in the Downloads folder and copy them to another folder (the folder that Transmission is watching). But it keeps giving syntax problems having to do with the "\" and the ")". Anyone see my mistake or have any input? Thanks!



mysterytramp
Sep 15, 2008, 06:41 AM
It's burping on your string. Try changing it to this:

do shell script "find ~/Downloads \\( -type f -name \"*.torrent\" \\) -exec cp {} ~/Torrents \\;"

GimmeSlack12
Sep 15, 2008, 09:32 AM
It's burping on your string. Try changing it to this:

set testString to "find ~/Downloads \\( -type f -name \"*.torrent\" \\) -exec cp {} ~/Torrents \\;"

Well done MysteryTramp, I appreciate the insight.