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
    Likes Received:
    0
    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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.