"Find" command and Applescript

Discussion in 'Mac Programming' started by GimmeSlack12, Sep 14, 2008.

  1. macrumors 603

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
    #1
    Ok this one has stumped me. I want to run an shell script within an Applescript.

    Code:
    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!
     
  2. macrumors 65816

    mysterytramp

    Joined:
    Jul 17, 2008
    Location:
    Maryland
    #2
    It's burping on your string. Try changing it to this:

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

    GimmeSlack12

    Joined:
    Apr 29, 2005
    Location:
    San Francisco
    #3
    Well done MysteryTramp, I appreciate the insight.
     

Share This Page