Help deleting/moving folders to trash??

Discussion in 'AppleScript' started by djentangle, Jun 8, 2012.

  1. djentangle

    djentangle New Member

    Joined:
    Jun 8, 2012
    Messages:
    1
    Hey all,

    I'm trying to learn apple scripting, and currently need to figure out a way to delete all the old left over files from an uninstall of adobe CS5 master collection. The uninstall left all the folders and bits of pieces of the old application in my application folder. I need to write a script to clean up the application directory before I use my jamf casper server to push out my CS 5.5 master/design package to my user community.

    I've written this which works but only if the folder exist, if the folder doesn't exist, the script halts and fails..

    Here's my basic script to move the folders to the trash.

    try
    tell application "Finder"
    move (folder "Mac HD:Applications:Adobe After Effects CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Contribute CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Device Central CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Dreamweaver CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Encore CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Extension Manager CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Fireworks CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Flash Builder 4:") to trash
    move (folder "Mac HD:Applications:Adobe Flash Catalyst CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Flash CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Illustrator CS5:") to trash
    move (folder "Mac HD:Applications:Adobe InDesign CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Media Encoder CS5:") to trash
    move (folder "Mac HD:Applications:Adobe OnLocation CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Photoshop CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Premiere Pro CS5:") to trash
    move (folder "Mac HD:Applications:Adobe Soundbooth CS5:") to trash

    end tell
    end try


    Can anyone help me add the code I need to basically say "if this folder exist, move the folder to the trash", "if this folder doesn't exist to move to the next line of code"?

    Let me know, any help is much appreciated.

    Steve
     
    djentangle, Jun 8, 2012
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JBmac
    Replies:
    5
    Views:
    984
    bluekatt
    Jan 3, 2007
  2. Newsbot
    Replies:
    0
    Views:
    469
    Newsbot
    May 19, 2007
  3. Newsbot
    Replies:
    0
    Views:
    493
    Newsbot
    May 26, 2007
  4. janetach

    Moving items to trash

    janetach, Sep 29, 2011, in forum: Mac OS X
    Replies:
    0
    Views:
    520
    janetach
    Sep 29, 2011
  5. jj
    Replies:
    1
    Views:
    290
    Howard S Shubs
    Jun 29, 2003
  6. Jorl Shefner
    Replies:
    1
    Views:
    388
    Tom Stiller
    Aug 2, 2005
  7. The New Guy

    Deleting files not in Trash

    The New Guy, Nov 25, 2007, in forum: Mac
    Replies:
    7
    Views:
    409
    The New Guy
    Nov 26, 2007
  8. pfisch
    Replies:
    4
    Views:
    783
    Kaveman
    Dec 27, 2011
Loading...