6 Replies Latest reply: Nov 1, 2008 9:38 AM by JLip
JLip Level 1 Level 1 (10 points)
Hi, I'm relatively new to Automator. I tried to write an Automator action to do the following but couldn't, so I'm hoping for some help.

Here's what I'd like to do:
1 - Manually open a folder
2- Use an Automator action to select all of the files in that folder, and move them to another folder on my computer. The destination would be the same every time, so preferably that would be programmed into the Automator action.

That's it. Hopefully this is easy. Thanks.

iMac 24" (Intel), MacBook Pro, iBook G3, iPhone, Mac OS X (10.5)
  • Niel Level 10 Level 10 (285,330 points)
    Open the Script Editor in the /Applications/AppleScript/ folder and run the following:

    tell application "Finder"
    move every file of window 1 to folder "Oct 31"
    end tell

    This script assumes the destination folder is on the desktop; if it isn't, use a path such as "Macintosh HD:Users:Shared:folder"

  • JLip Level 1 Level 1 (10 points)
    Thanks. I tried that, and got the following error: Finder got an error: Can’t get window 1.

    Instead of Window 1, I tried the name of the folder (it's on the desktop), but it still didn't work.

    Separately, is there a way to do this in Automator? I find that to be an easier way to program occasional tasks.
  • Niel Level 10 Level 10 (285,330 points)
    Open the folder manually before running the script.

  • JLip Level 1 Level 1 (10 points)
    Thanks, that worked. But is there a way to do this in Automator?
  • Simon Aughton Level 1 Level 1 (25 points)
    It should be straightforward. These four actions will do it:

    Get Specified Finder Items—select the folder you wish to copy from;
    Open Finder Items—leave setting as Default Application*;
    Get Folder Contents;
    Move Finder Items—select the destination folder.

    If the originating and destination folders are always the same then you can save this as an application and run it as required. If either folder changes, you’ll have to open it in Automator, change the folders as required, then run the workflow.

    *The Open Finder Items action is redundant, but you did say you wanted to open the folder. Can’t see the point really, since it’s about to be emptied.
  • JLip Level 1 Level 1 (10 points)
    Perfect! Thanks very much.