Friday, January 19, 2018

#1 2005-11-05 07:12:33 pm

gdenny
Member
Registered: 2005-11-06
Posts: 1

Automate Naming and Copying?

Hi, I'm a newbie to using Automator and suddenly find myself desperate to learn it for a specific business reason. So, I'll keep my question simple: is there a way to automate naming a new USB thumb drive and then copying a specific folder from the desktop to the newly-named USB drive. The reason I'd like to automate the procedure is because it has to be done 175 times for a conference. Can anyone please, please help?

Offline

 

#2 2005-11-07 10:40:05 am

Kevin Wolfe
Member
From:: Cincinnati OH USA
Registered: 2005-10-27
Posts: 67
Website

Re: Automate Naming and Copying?

Rename Finder Items can rename the HD. (Don't ask.) So I assume it can rename a thumbdrive.

It might be a little tricky, but this is probably how to do it.

Get Specified Finder Items (check show when run option)
Rename Finder Items (Replace text, check show when run)
Get Specified Finder Items (Click Files/Folders at the top and chose Ignore Previous Results, check show when run box)
Copy Finder Items (check show when run)

Run the workflow. Add the drive to the list. Click continue. Insert the text in the boxes. Click continue. Add the folder to the list. Click Continue. For "to", choose the new drive name from the list.

Once you've run it and saved it, most the names and pathways are remembered. You can unheck the show when run option on any actions that are consistent each time you run the workflow. You can also save it as an app for easy running.

Hope that does it,

Kevin

Offline

 

#3 2005-11-07 11:36:56 am

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: Automate Naming and Copying?

If it's possible for you to use AppleScript instead of Automator, then you could try something like this:

Applescript:

property newName : "Your New Thumbdrive Name"
property theFolder : (path to desktop as text) & "Your Folder Name"

tell application "Finder"
   activate
   
   repeat
       set diskList to name of every disk whose ejectable is true
       count result
       
       if result is 1 then
           set theDisk to disk (first item of diskList)
       else if result > 1 then
           choose from list diskList default items {first item of diskList}
           
           if result is not false then
               set theDisk to disk (first item of result)
           else
               return false
           end if
       else
           display dialog "No removeable drives were found." buttons "Cancel" default button 1 with icon note
       end if
       
       try
           set name of theDisk to newName
           set theDisk to disk (result)
           duplicate (alias theFolder) to theDisk
           eject theDisk
       on error errorMsg number errorNum
           display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
       end try
       
       display dialog "Script finished successfully." buttons {"Stop", "Repeat"} default button "Repeat" with icon note
       
       if button returned of result is not "Repeat" then exit repeat
   end repeat
end tell


Filed under: Finder

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)