Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm new to Automator, but I've had a Mac for quite some time, and I'm not a total noob. :)

Here is my problem: Users need to make a backup (to desktop) of a folder located on a network drive. The folder name on the network drive is the same as the user's short username.

This is no problem if the user selects the folder themselves; I´ve made a workflow that does this. But I need this script to automatically find the folder on the network drive, based on the username and copy it to the desktop.

Any ideas how to find that folder and pass it on as my inputfolder variable? I assume I need to use a bash shell or applescript command in my workflow?

share|improve this question
    
So, you want make an application what when is executed will copy an folder (with name = $USER) from the known network path (what is already mounted - e.g. the path is exists in the "/Volumes/something" to the ~/Desktop. right? –  jm666 Jun 11 '11 at 23:18
    
Thats it. I have everything ready, just need the shell command to select the folder (with name = $USER) then pass it on the workflow as a variable (input) the copy is made later in the workflow with: (Get value of variabel (input and output) then get folder contents and finaly copy finder items) –  iFuse Jun 12 '11 at 17:20
add comment

2 Answers

With the information provided, I think the following should work (screenshot follows):

Run Shell Script
echo "afp://192.168.0.115/foto/"
Ignore input

Get Specified Servers

Connect to Servers

New Folder
Name: Backup
Ignore input

Set Value of Variable
Variable: Destination

Run Shell Script
echo "/Volumes/foto/$USER"
Ignore input

Copy Finder Items
To: Destination variable (drag the "Destination" variable from the variable list to the "To" menu)
Check "Replacing existing files" if needed.

Variation for Incremental Backups

If you want incremental backups, you could replace Copy Finder Items with New Dated Folder, also setting its Destination to the Destination variable, and setting the "Action with passed items" option to "Duplicate passed items to the new folder". Make sure to enter something in the "Name" field, otherwise it won't work. To keep the backups listed in chronological order, you can set the Format to be Year-Month-Day and check the following options: "Leading zero for day", "Leading zero month", and "Month as number".

Screenshot of Automator workflow as described above

share|improve this answer
add comment

Finally you told what you have done. Now need to know what is the result after your 3.Connect to Servers. Because, the path depends on it.

Check the next screenshot, the connect returns /Volumes/minidata and the script add only the foto part.

automator screenshot

share|improve this answer
    
ok, it´s not working. The Shell script works though, and it seems to pass itself on as a variable. But! when i call the variable later in the workflow nothing happens? it does not call the path. maby the path is written wrong? : echo "/afp:192.168.0.115/foto/$USER" I would like to post pictures of my workflow but im not allowed since im new here. –  iFuse Jun 13 '11 at 21:28
    
also tried: echo "afp:192.168.0.115/foto/$USER" –  iFuse Jun 13 '11 at 21:29
    
Even tried a local folder, same thing. The shell script should work just like Get Specified Finder Items. –  iFuse Jun 13 '11 at 21:33
    
as you can see, all actions was passed ok, and got the folder copyed into may Desktop - so, try be more exact FROM WHERE want copy? I already asked you than the PATH IS IN /Volumes. It is in? or you havent a mounted remote fs? –  jm666 Jun 13 '11 at 21:38
    
So you want mount the network drive first? –  jm666 Jun 13 '11 at 21:40
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.