• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1654
  • Last Modified:

S - Using automator to script a file copy


I have a local directory on my MAC OS X laptop that I would like to have do a copy on startup and shutdown to a Windows Server.  I would like to use automator to do this.  I played with it a bit so far but nothing going.  Does anyone have suggestions ?

  • 2
1 Solution
VSACITAuthor Commented:
hmmm ... nothing really screams to me as a process for doing this copy ... someone has bound to have done this at some point in the past no ?
If you know the IP/Name of the server then you can create a script that connects to the server and copies selected files to it.

The script can then be saved as an application and put in your startup items, but you would have to create some sort of logout hook to get it at shutdown (this can be setup with a line like this in the terminal):

sudo defaults write com.apple.loginwindow LogoutHook /path/to/script

Before you create this script you will need to connect to the required server (have it mounted on your computer). It is advisable to set it to remember the username and password if you are wanting it to log in automatically (rather than the user who using the computer at the time having to do it every time)

To create the script:

1. Open a new script in automator
2. Click on the 'Finder'  in the 'Applications' list (down the left hand side)
3. If you know the server Name/IP copy the item 'Get Specified Server' to the workflow and then input their locations into the options specified
4. If you dont know the server Name/IP copy the item 'Ask for Servers'
5. Add the 'Connect to Servers' item into the workflow (you should now have two items in the workflow)
6. Add the 'Get Specified Finder Items' and then select the folder/files you are wanting copied to the server every time
7. Add the 'Copy Finder Items' item to the workflow, click the 'Other' location in its options, navigate to the place you want on the server and save this location in the script (you will have to decide if you want the folder to replace previous versoins every time, or to end up with 'Folder', 'Folder1', 'Folder2' etc on the server)
8. Unmount the server in the finder and in automator try running the script.
9. If you are happy with the results, save the workflow as an application and then use the startup items to run it at startup and the line above for the shutdown items

There are other methods to do this if this doesn't work properly, although it does rely on Automator using other applications (like Transmit) to copy items to a 'Favorite' server)

I apologize if some of this seems a bit easy, wasn't sure if you had done anything like this before
VSACITAuthor Commented:
that works perfectly ... Thank you ...

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now