S - Using automator to script a file copy

Posted on 2006-05-23
Last Modified: 2013-11-17

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 ?

Question by:VSACIT
    LVL 6

    Expert Comment


    Author Comment

    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 ?
    LVL 5

    Accepted Solution

    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 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

    Author Comment

    that works perfectly ... Thank you ...

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Apple's Mac OS X has become an official member of the malware club. The Flashback Trojan has affected over half million Macs, worldwide. It is behavior that ultimately gets malware onto a person’s computer. Obsolete or out-of-date software helps…
    How can this article save you time AND money?  In just a few minutes you may discover something you didn't know existed that is easy enough for you to fix yourself!
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now