Fetch Help > Using Fetch > More examples of using Automator with Fetch

NOTE: Fetch 5.8 does not offer Automator support. The documentation below is only accurate for Fetch 5.7.7 and earlier. Automator support may return in a future release of Fetch.

Fetch includes a number of actions for Mac OS X's Automator, allowing you to create simple workflows that can automate a variety of Fetch tasks.

This topic describes some more examples of time-saving things you can do with Automator and Fetch. If you are not familiar with Automator, you may want to start by reading the introduction to using Automator with Fetch help topic, which also includes simple example workflows for uploading or downloading specific files.

For more details about each action, see the Automator actions help topic.

Advanced Upload Droplet
Control-click In the Finder to Upload
Batch Change Permissions
Batch Rename Files
Multiple Server Upload Droplet
Download All Files Created Today
Delete All Old and Large Files
Print a PDF to a File Server
Setting Up a Watch Folder

## Advanced Upload Droplet

Create a workflow that consists of an Upload Files action, configured for your favorite upload location, plus any actions you want to take after uploading the files — if you want to automatically change the files' permissions or rename the files after uploading them, add a Set Fetch Item Permissions or a Rename Fetch Items action after the Upload Files action.

Then save the workflow as an application: in Automator, choose File > Save As and choose Application from the File Format pop-up menu.

When you drag files and folders to the droplet, they'll be uploaded to your server automatically and modified according to the other actions that you included.

If you simply want a droplet to upload files to a specific server, and do nothing more, creating a droplet shortcut may be an easier solution than using Automator. See the droplet shortcut help topic for more information.

## Control-click In the Finder to Upload

If you're using Mac OS X 10.6 or later, create Create a new workflow, choosing Service from the template selector. Add an Upload Files action to the workflow and configure it for your favorite upload location, then save the workflow.

If you're using Mac OS X 10.5, create a workflow that consists of an Upload Files action, configured for your favorite upload location, then save the workflow as a Finder plug-in: in Automator, choose File > Save As Plug-In, and choose Finder from the Plug-in for pop-up menu.

Now when you Control-click on files and folders in the Finder, you can choose your saved workflow from the Automator submenu of the contextual menu to upload your files automatically (on Mac OS X 10.5, after you Control-click, choose the More submenu, then the Automator submenu). If you want to automatically change the files' permissions or rename the files after uploading them, add a Set Fetch Item Permissions or a Rename Fetch Items action after the Upload Files action.

## Batch Change Permissions

Create a workflow that consists of a Get Selected Fetch Items action, followed by a Set Fetch Item Permissions action. Then select the files whose permissions you want to set in a Fetch transfer window, and run the workflow. While you can batch change permissions using the info window, you cannot set file and folder permissions independently when you do that; with the Set Fetch Item Permissions action, you can.

If you want to recursively change permissions (that is, change the permissions for all the files and folders inside the items you've selected) insert a Get Fetch Folder Contents action before the Set Fetch Items Permissions action, and check the "Repeat for each subfolder found" checkbox. Use with caution, since setting permissions is not undoable.

## Batch Rename Files

Create a workflow that consists of a Get Selected Fetch Items action, followed by a Rename Fetch Items action. Select the renaming options you want in the Rename Fetch Items action. Then in a Fetch transfer window, select the files whose names you want to set, and run the workflow. Use with caution, since renaming is not undoable.

## Upload Files to Multiple Servers Droplet

If you want to upload the same set of files to several different servers, you can create an Automator workflow that uses variables to simply the task. The workflow stores the list of files you want to upload in a variable, so that you can recall the list of files repeatedly (because Automator will not store the list after the first action otherwise).

Create a workflow with the following actions:

1. Sort Finder Items - You only need to add this action on Mac OS X 10.5 to force the Set Value of Variable action to work correctly; the files don't actually need to be sorted. It doesn't matter how you sort the items.
2. Set Value of Variable - This will store a reference to the files that were dropped on the workflow (you can give the variable any name you like, e.g. "Dropped Items").
3. Upload Files - Configure for the first server you want to upload the files to.
4. Get Value of Variable - From the pop-up menu, choose the variable you specified in step 2. This will recall the reference to the dropped files.
5. Upload Files - Configure for the next server you want to upload the files to.

Repeat steps 4 and 5 3 and 4, adding as many "Get Value of Variable" and "Upload Files" actions as necessary, for all the servers you want to upload to.

Then save the workflow as an application: in Automator, choose File > Save As and choose Application from the File Format pop-up menu.

When you drag files and folders to the droplet, they'll be uploaded to all the servers automatically.

## Download All Files Created Today

If you have a folder on your server where clients or co-workers put new files for you, you can create a workflow that will check that folder for new files and download them all. Create a workflow with the following actions:

1. Get Specified Fetch Items
2. Get Fetch Folder Contents
3. Filter Fetch Items: Whose "Item Type is File"
4. Filter Fetch Items: Whose "Modification Date Is Today"
5. Download Fetch Items

Configure the Get Specified Fetch Items action with the server and folder that you want to check, and in the Download Fetch Items, choose the local folder where you want the files downloaded to. If you'd rather download files that were modified in the last week, change the second Filter Fetch Items action's options to be "Modification Date Is within the last week," or any other time period you prefer.

The Get Fetch Folder Contents action gets a list of the contents of the folder. The "Item Type is File" filter action ensures that only files will be downloaded, not the entire folder being checked, or any folders in it.

## Delete All Old and Large Files

If you have a folder on your server that often fills up with junk, you could create a workflow that will look in that folder and delete any old, large files to free up space on the server. Create a workflow with the following actions:

1. Get Specified Fetch Items
2. Get Fetch Folder Contents
3. Filter Fetch Items: Whose "Item Type is File"
4. Filter Fetch Items: Whose "Modification Date Is More Than a Month Ago"
5. Filter Fetch Items: Whose "Size Is greater than 500 KB"
6. Delete Fetch Items

Configure the Get Specified Fetch Items action with the server and folder that you want to remove files from. Adjust the time and size values of the second and third filter items as you prefer.

The Get Fetch Folder Contents action gets a list of the contents of the folder. The first Filter Fetch Items action that filters for files is necessary to prevent you from deleting an entire folder accidentally (because it's unlikely you want this workflow to do that).

Since deleting items is not undoable, be very careful when using a workflow similar to this one. If you check the "Ask before deleting" checkbox in the Delete Fetch Items action, you will have a chance to see which files will be deleted and cancel the action.

## Print a PDF to a File Server

If you're using Mac OS X 10.6 or later, create Create a new workflow, choosing Print Plugin from the template selector. Add an Upload Files action to the workflow, and configure it for the server and remote folder where you want the PDFs to be uploaded. Then save the workflow.

If you're using Mac OS X 10.5, create a workflow that consists of an Upload Files action, configured for your the server and remote folder where you want the PDFs to be uploaded. Then save the workflow as a Print plug-in: in Automator, choose File > Save As Plug-In, and choose Print Workflow from the Plug-in for pop-up menu.

Now you can create and upload a PDF document to that server from the Print dialog of any application. In the standard Mac OS X Print dialog, click the PDF button, and choose your saved workflow from the PDF menu. The PDF is created and uploaded automatically. (The PDF uploaded to the server will have the same name as the file you're printing, followed by the .pdf extension.)

## Setting Up a Watch Folder

If you'd like files to be automatically uploaded when you move or save them to a specific folder on your Mac — often referred to as a watch folder — you can use Fetch's Automator support together with a feature of Mac OS X called folder actions to set one up. See the setting up a watch folder help topic for more information and step-by-step instructions.