Rename Finder Items with Automator in Leopard

I used following automator actions to rename all files contained in selected folders in Mac OS finder:
1. Get Selected Finder Items
2. Get Folder Contents (repeat for each subfolder found option on)
3. Rename Finder Items (Add Text before name, Show action option on)
First two actions were executed flawlessly. Unfortunately after keying in text to be added in front of every file name in text field of popup window on execution of last action, no file name was changed. Then I realized that same actions performed in automator application instead of invoking through Finder's contextual menu worked as expected. So the problem seem to be related to initialization of text value in text field of the action.
I decided to try with new variable feature introduced in Leopard version of automator. Clicking on Variables button next to Actions button in menu bar of Automator, then select following item:
Library > Text & Data > New Storage
I managed to provide a text value for the New Storage variable through "Library > Text > Ask for Text" and "Library > Utilities > Set Value of Variable" actions, but text field in Rename Finder Items action seem to reject the New Storage variable completely. So the attempt to provide text value to the Rename Finder Items action through user initialized variable failed without reason.
May I know how can I make use of variables to set text fields in Rename Finder Items action ? Is the above mentioned failure a confirmed bug of Leopard waiting to be fixed by Apple (after one whole year of beta testing !!) ? Thanks in advance.

I figured out a way to use variables in the Rename Finder Items.
In my case I want to rename the files to a sequential name. I can't link the variable to the "New Name" box in the Automater GUI.
But it helps to know that that the Automator is just creating an XML file and you can edit this directly.
To do this, create the Automator workflow and save it. Give the variable some distinct name like "myVariable".
In Finder, right click the Automator file and select Show Package Contents. Within this folder go to Contents and find the document.wflow file. This is the XML file, so open it with TextEdit or something.
Search the file for your variable name. The first instance of it should be in a section that starts with <key>variables</key>. All the variables will be listed here. Each variable has several lines to define it. The first will be the UUID. The UUID will have a line that is something like: <string>BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E</string>. The BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E is how Automator refers to your variable. Search the file for this UUID string and you will see. Whenever Automator wants to insert the variable, it will enter $(BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E).
Copy this string, with the $() surrounding it. Close the wflow file. Now you can go back to Automator itself and paste it wherever you want your variable to appear, even if you can't normally insert the variable into that field.

Similar Messages

  • Capitalized finder item with automator

    I've quite a lot of items on the finder that I want to quickly capitalize the name of it,
    how can I do that with automator?

    I figured out a way to use variables in the Rename Finder Items.
    In my case I want to rename the files to a sequential name. I can't link the variable to the "New Name" box in the Automater GUI.
    But it helps to know that that the Automator is just creating an XML file and you can edit this directly.
    To do this, create the Automator workflow and save it. Give the variable some distinct name like "myVariable".
    In Finder, right click the Automator file and select Show Package Contents. Within this folder go to Contents and find the document.wflow file. This is the XML file, so open it with TextEdit or something.
    Search the file for your variable name. The first instance of it should be in a section that starts with <key>variables</key>. All the variables will be listed here. Each variable has several lines to define it. The first will be the UUID. The UUID will have a line that is something like: <string>BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E</string>. The BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E is how Automator refers to your variable. Search the file for this UUID string and you will see. Whenever Automator wants to insert the variable, it will enter $(BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E).
    Copy this string, with the $() surrounding it. Close the wflow file. Now you can go back to Automator itself and paste it wherever you want your variable to appear, even if you can't normally insert the variable into that field.

  • Rename Finder Items from Automator doesn't work correctly!

    I made a rename finder items in Mac OS X 10.4 by just using rename finder items task and save as a plug in for finder. It was working fine. I tried to use it in 10.5, but it doesn't really change the names. I created a new one or even tried to modify the workflow, but it still not working. Can someone verify the issue? Thank you.

    I can verify the issue, but I have no solution. Very frustrating, as I used to batch rename all the time in just the same way.

  • Automator Rename Finder Items NOT working in Leopard

    I used to be able to Replace Text in filenames, as you would expect with Automator, now my old or new Automator actions don't work for this, whether I run them as a Finder plugin or from the Automator Run button...
    Anyone else have this problem, or better yet success?

    The real problem here is, why does the Finder have to be so ********! Why all this trouble just to change filenames?!?! Why use automator to do something so simple?!?! I have to use but I hate it!
    Please, despite all the Windows problems and faults (and I hate Windows and love Mac), they have a better file manager then we do, because the explorer is a good tool unlike the finder! Why can't we just choose the items and do some "rename" option, or just select all, press "enter" and write what we want (doing a sequential rename by default).
    Come on, if windows explorer can do this, why can't we?!?!?
    The automator should be used to more advanced stuff, not to just simply rename items...

  • Rename finder item withouth user to choose find string.

    Hi,
    I've built an automator workflow in wich I create a standard folder /w subfolders. Automator then renames the folders, by rename finder item with replace text.
    The new name is a projectname an user can give in. But I don't want the user to change the find string. Is there a way to work this out?
    I've tried to do an ask for text, but I don't know to how I can put the result into the replace field?
    Thx,
    Marlon
    Powerbook G4 (1Ghz)   Mac OS X (10.3)  

    I figured out a way to use variables in the Rename Finder Items.
    In my case I want to rename the files to a sequential name. I can't link the variable to the "New Name" box in the Automater GUI.
    But it helps to know that that the Automator is just creating an XML file and you can edit this directly.
    To do this, create the Automator workflow and save it. Give the variable some distinct name like "myVariable".
    In Finder, right click the Automator file and select Show Package Contents. Within this folder go to Contents and find the document.wflow file. This is the XML file, so open it with TextEdit or something.
    Search the file for your variable name. The first instance of it should be in a section that starts with <key>variables</key>. All the variables will be listed here. Each variable has several lines to define it. The first will be the UUID. The UUID will have a line that is something like: <string>BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E</string>. The BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E is how Automator refers to your variable. Search the file for this UUID string and you will see. Whenever Automator wants to insert the variable, it will enter $(BD464B7A-ACDE-4A63-B595-FAF1DA6DE26E).
    Copy this string, with the $() surrounding it. Close the wflow file. Now you can go back to Automator itself and paste it wherever you want your variable to appear, even if you can't normally insert the variable into that field.

  • RENAME FINDER ITEMS

    - I am using the function RENAME FINDER ITEMS to rename hundreds of files. It is possible to use wild chars in the FIND field ?
    - All my file names start with date (example: 2010-04-10 xxxx.yyy) and i want to rename it to xxxx.yyy.
    thank you,
    Paulo

    I don't think Automator can do this task for you. Consider Name Mangler instead: http://manytricks.com/namemangler/.

  • Workflow and/ or script to rename finder items using a .txt or a .csv file as a reference?

    Can someone assist me, I am looking for a workflow and/ or script that would allow me to rename finder items using a .txt or a .csv file as a reference for the new naming convention?

    THANK YOU!!!! 
    I have taken your recommendation and enabled the script menubar item.  I also tweeked the script as you recommended, I will play with both options to see which I prefer.   I thank you again for the quick turn around on this. 
    If I am to understand your comment correctly about placing the .csv file in the same folder as the files to be renamed I should modify the script as such.
    REMOVE:    
                        set csvFile to choose file with prompt "Select the CSV file." of type "public.text"
                        set workingFolder to (choose folder "Select the folder to be processed") as text
                        set fileList to (POSIX path of (files of folder workingFolder whose visible is true and name begins with "untitled"))
    REPLACE WITH:     
                        set csvList to paragraphs of (read "/path/to/csvfile.csv")
                          set fileList to (POSIX path of (files of folder "/pah/to/folder" whose visible is true andname begins with "untitled"))
    After reading this and attempting to modify it I am missing one piece of markup or the arrangement of the markup.
    Please find the modified script with options:
    -- change this to specify the correct csv delimiter
    set splitDelimiter to ","
    -- change this to specify the file name join character
    set recombineDelimiter to "_"
    -- choose the csv file
    set csvFile to choose file with prompt "Select the CSV file." of type "public.text"
    -- choose the folder
    set workingFolder to (choose folder "Select the folder to be processed") as text
    -- csv contents as list
    set csvList to paragraphs of (read csvFile)
    --set csvList to paragraphs of (read "/path/to/csvfile.csv")
    tell application "System Events"
    -- list of files in alphabetical order
         set fileList to (POSIX path of (files of folder workingFolder whose visible is true and name begins with "untitled"))
      -- set fileList to (POSIX path of (files of folder "/path/to/folder" whose visible is true and name begins with "untitled"))
         repeat with i from 1 to count of fileList
    -- get a file from the file list and note its extension
              set currentFile to file (item i of fileList)
              set fileExtension to name extension of currentFile
    -- get a line from the csv list, split it at the delimiter,  and recombine it
              set {oldTID, my text item delimiters} to {my text item delimiters, splitDelimiter}
              set newFileNamePieces to text items of (item i of csvList)
              set my text item delimiters to recombineDelimiter
              set newFileName to newFileNamePieces as text
              set my text item delimiters to oldTID
    -- write the new name back out to the file
              set name of currentFile to (newFileName & "." & fileExtension)
         end repeat
    end tell

  • How to display the current name when renaming Finder item

    Is there any way to get Automator to display the current name of a Finder item when renaming an item?
    I want my users to be able to copy and rename a folder template but I want to display the folder template's current name as a default in the renaming dialogue window, so the user follows the correct naming format.

    Since you've already hacked into it, if you've got developer tools installed, it is most likely in the nib file that is in the English project folder in the Resources.
    I don't know what further implications that will have on the app in general, though.
    If you are a little adept at applescript, you may want to create your own Applescript Studio app to do this instead of Automator. Also, take a look at Platypus to make a wrapper around you applescript instead of AS Studio.
    Message was edited by: Barney-15E

  • "get specified finder items" in automator pulling more than specified

    In part of a larger workflow I copy 5 files to my iDisk. In the next step I select one of those items again using 'get specified finder items' from the same location, add a date to its name in the next step with the 'add date or times to finder item names' then finish the workflow.
    However what is happening is the 'get specified finder items' I'm using to grab the file to be renamed, is actually grabbing all 5 of the files from the previous step. Only the one is showing in the 'get specified finder items' list but it grabs all 5 anyway.
    Anyone see this before? Know a way to fix it?
    Your help as always is very much appreciated. Thank you!

    Keith Kaiser1 wrote:
    In part of a larger workflow I copy 5 files to my iDisk.
    In the next step I select one of those items again using 'get specified finder items' from the same location,
    control-click on this "get specified items" action and select "ignore input". otherwise the previous action in the workflow will pass its output as input for this one. that's what's causing the doubles.
    add a date to its name in the next step with the 'add date or times to finder item names' then finish the workflow.
    However what is happening is the 'get specified finder items' I'm using to grab the file to be renamed, is actually grabbing all 5 of the files from the previous step. Only the one is showing in the 'get specified finder items' list but it grabs all 5 anyway.
    Anyone see this before? Know a way to fix it?
    Your help as always is very much appreciated. Thank you!

  • Selecting Finder Items in Automator

    I am a long-time MAC user but have never used applescript or automator. I work in a Prepress department and need to find a simple way to select certain folders quickly.
    Here's the scenario:
    I have a folder full of jobs. They would look something like this:
    12345_AdvertisingAgency
    12349_CarCompany
    13245_WhoeverCompany
    13568_AnyCompany
    Typically this folder would contain 500-600 folders with the same naming convention.
    I need to find a way to ignore the first six characters (all 5 numbers + the underscore) and select the folder by the first letter after the underscore so that I can put all the "A's" in one folder, all the "B's" in another folder, and so on through the alphabet.
    Does anyone know of an automator action that can do this?
    Thank for any help.

    Your Prep:
    1. Create the destination folders, A, B, C, etc.
    Your workflow:
    1. Find Finder Items - Where= +jobs parent folder+ | Whose=Name-Contains-_A
    click on Options and select 'Show Action When Run'
    2. Move Finder Items- To= +destination folder+ ( A )
    click on Options and select 'Show Action When Run'
    Running it:
    Hit the Run button. The first time you run it, the options are already set to move all the A jobs so you should be able to just hit Return to move through.
    On subsequent runs, just change the letter/folder in Whose and To

  • "Ask for Finder Items" Automator action broken?

    OK, I'm pulling my hair out on Automator (again). I'm on OS X Lion 10.7.1.
    Here's what I want to do: I have image files named "something-something (S1).png" and I want to create a copy of each file named "something-something (S2).png" then resize that copy to 50% the size of the original. A perfect choice for Automator, I would have thought.
    So here's the workflow I came up with:
    1. Ask for Finder Items: Type set to Files and Allow Multiple Selection checked.
    2. Duplicate Finder Items: To create a copy, hopefully named "something-something (S1) copy.png".
    3. Rename Finder Items: Set to Replace Text, with Find set to "(S1) copy" and Replace set to "(S2)" (in basename only).
    4. Scale Images: Set to By Percentage 50.
    I would have thought that would have worked. Trouble is, it doesnt even get to first base. When I run the workflow I see the expected choose file dialog, and I choose a test PNG file. Then Automator happily announces that "Ask for Finder Items completed" in the log, and proceeds to sit .. and sit ... and sit. It says it's running, but nothing is happening. No duplicate file action happens, no rename .. nothing. Oh, and yes, I do see the selected filename in the "Results" area for the Ask for Finder Items action.
    What's going on? Any ideas? For a supposedly intuitive tool I find automator inscrutable (and I'm a 30 year seasoned operating system oftware developer).
    TIA,
    --Tim

    FWIW, if you've found a bug, please contact Apple Support folks or (if you have access) use the BugReport tool. 
    (This is a user forum, and the Apple Engineering folks may or may not see any reports that are posted here.)

  • Automator - how reset Finder Items?

    I want to to defrag a big file, so I have thought to copy the file in an external disk, than rename the file in external disk and copy to directory in which there is the file to defrag.
    Than revert to the original name the file in the external disk.
    In this way I have a copy of the file in external disk and the original file and the file copied in HD.
    I do that to avoid failure of external Hard Disk that could have the result to destroy the original file if this happen during the copy from external to internal HD.
    I have made a workflow that do this:
    1) Get Specified Finder Items (pictures/file)
    2) Copy Finder Items (to DK1)
    3) Rename Finder Items (DK1/file to DK1/filecopy)
    4) Copy Finder Items (to pictures)
    5) Get Specified Finder Item (DK1/filecopy)
    6) Rename Finder Items (DK1/filecopy to DK1/file)
    The problem is that in the 5 step the item passed to the 6 step are two (pictures/filecopy and DK1/filecopy).
    I want only DK1/filecopy.
    I have seen that Item passed to various step are:
    1) Get Specified Finder Items (pictures/file) >>passed picture/file
    2) Copy Finder Items (to DK1) >>passed DK1/file
    3) Rename Finder Items (DK1/file to DK1/filecopy) >>passed DK1/filecopied
    4) Copy Finder Items (to pictures) >>passed pictures/filecopied
    5) Get Specified Finder Item (DK1/filecopy) >>passed two pictures/filecopied and DK1/filecopied
    6) Rename Finder Items (DK1/filecopy to DK1/file) >> in error
    I have have tried to make two workflow one with the step from 1 to 4 and another with the step 5 and 6.
    If they run separately all is ok, but if they run in a single workflow (that is made with the step from 1 to 4 and the 5 step that recall the second workflow) happen the same thing that I have described before.

    Stanley Horwitz wrote:
    I have been working with Macs since 1986 and in the IT industry full time since about the same time and I honestly have no clue what you are attempting to do. What does "defrag a file" mean and why do you want to do that?
    I want to copy a file to an external device, so system, copying file, write this without fragmentation, and then copy to original location.
    In this way the result is to have the file unfragmented.
    If you want to defrag your disk, by far the easiest and quickest way to do that is to take another disk drive that's as big or bigger in capacity as the disk you want to defrag, then format that disk, then simply use your favorite disk cloning tool to copy the contents of the disk you want to defrag to the other disk. The copying process to a newly formatted disk will write the data in an optimum manner onto the disk without any fragmentation on the destination disk. You can then, if you so desire, reverse the process and clone the cloned drive back to the original drive and you will end up with two defragmented disks with the same data on them. The biggest benefit to this strategy is that you get a complete backup of the contents of the disk.
    OK, but I only want defrag 1 file, not all the disk.
    If You see, I want the same manner that You suggest for the entire disk, applied only to 1 file.
    There are also several utilities that will do disk defragmentation such as TechTool Pro and Disk Warrior. I think though that in all but the most extreme cases, it is a wast of time to use those utilities to defragment a disk. In fact, in most cases that I have seen on home Macs, the benefits of defragmentation are minimal at best, which is why I suggest simply doing a backup of the disk to another disk, because the big benefit there is that you have a fresh backup which is far more important in most cases than defragmenting a disk.
    OK, I don't want defrag utilities, because I am not confident in the process.
    For backup I use regularly Time Machine on two external disks.
    All the matter is only to know if there is a manner to tell Automator wich is the file to use during the workflow.
    Thanks.

  • Automator (move finder items)

    I have a service that moves finder items to a particular folder. Since I started using this I noticed I occasionally will need to move an item with the same name into this folder. Is there a way I can get the service to move the second item with the same name, but instead of overwriting the first item, have it add a -1 or something? If I open something like a zip file multiple times in finder, it creates the second one with a 1 after the name. That's exactly what I need. Any way to do that with a service like this?

    No, I didn't give up on the thread, I just went to work with what you gave me to see what I could do with it. It's just that you've been nothing but extremely helpful and patient with me in the past; and I started to feel like I was coming to the board, putting up my problems, and you do everything for me. I know you're here to contribute to the community, but I don't like to take advantage. I am making an effort to learn this stuff now, I just have to make baby steps!
    Okay, here is the deal with this item. I actually want to apply this with more than one operation, but the basic script or concept would remain pretty much the same. We create lots of documents like invoices, receipts, shipping labels, etc., that usually get saved as pdf onto the desktop. Then, they are named, often with the date and particular file name and finally moved into the proper folders. For example, shipping labels get saved to desktop with the default name of something like
    vty3RlsIK.LabelGenerationServlet.part
    Then I would change the name to something like
    12-31-2009USPSLabel.pdf
    Then, I would move it to the folder where we keep the shipping labels for records.
    So, the service I created actually does more than just moving the file. It goes like this:
    service receives selected pdf
    in finder
    name single item in finder item names (to: USPS_Label.pdf)
    add date or time to finder item names (before name, underscore separator)
    move finder items (to target folder)
    open finder item (with default application)
    The other ones I need would be similar, except they don't usually need to be opened afterward, just named and moved, for the most part. I figured I could continue to just use the name change function of automator before running the script, but if would run faster or more efficiently if that were also part of the script, I suppose that would be better. And I would like to be able to have the numbers go up through as many as I need. If it's a matter of just adding in all the possibilities of existing names up to the number I need, that's tedious work I don't mind doing now to save on having to name all these files in the future!
    Also, these files are always named differently, so the source file would need to just be selected file, not the actual name.
    Finally, I tried to play with the script to name the desktop like you said, but would it be something like
    set source_folder to folder (path to desktop)
    or
    set source_folder to (path to desktop)
    I still need to learn a little more before I understand the way that works. I am so used to only using the unix path, I like the ability to use (path to desktop) that's really interesting.
    I think I may have rambled a bit, but that should explain the details of what I'm trying to accomplish.
    thanks

  • Automator's Filter Finder Items behaves incorrectly

    Can anyone confirm the misbehaviour of the Filter Finder Items in Automator when set to filter items whose date created is not in the last 7 days?  I have a workflow being used as a folder action to keep my downloads folder tidy but never runs right as it gets rid of content that I've just downloaded.
    Link to workflow: http://cl.ly/1S0h1I3m3r1t3l2a1W1J
    Insight would be appreciated.

    The only reliable way to do that would be to take an inventory of the filesystem, and compare it with an earlier inventory. I don't know of any easy way to do that with built-in tools. If you use Time Machine, there are third-party tools such as BackupLoupe that compare snapshots. Or you could try something like Uninstaller, though it's quirky and doesn't seem to be maintained much anymore.
    At an advanced level, there are UNIX tools such as mtree, which is built in, radmind, or tripwire, but you probably don't want to go there. I use radmind and mtree for different purposes, but they're not for the squeamish.

  • Issue with folder action created with automator

    Hello all,
    I'm having an issue with folder actions that i created with automator and it's driving me crazy. Apple says they can't help with things created by the user so this is my only shot at figuring this out.
    Running a Mini 2.3G quad i7, 8GB ram on OSX Mavericks 10.9.2
    My goal is to set up an action to add text to the filename of a file placed into a particular folder. So I open automator and choose folder action. Then I choose the folder I want the action applied to at the top. Then I go to Files and Folders in the library and choose rename finder items and drag it over to the workflow. I select add text, then add the text I want added to the file name and choose before name because I want the added text to preceede the original filename text. I save it then go to the folder I applied it to and right clikc go to services then folder actions and verify that the service is attached to that particular folder and it is.
    Should work right? No. When I place a file in that folder the action runs and adds the text like I want it to... but then it starts to add it over and over again in an infinite loop. It also adds a file with the extension .ds_store to the folder that also has the name added over and over.
    I've tried deleteing all the folder actions and even deleteing all the folder actions themselves saved by the automator in the workflow file in the user library.
    I'm stumped... no idea what to do. A while ago I had used the automator to batch rename files and it worked perfectly. I tried the same steps i listed above to set this action up on a machine in an Apple retail store and it worked... so I know I have the set up right.
    Any help is greatly appreciated.
    Thanks,
    Justin

    Hi JK257
    This is why it happens:
    The folder action is looking for new items in the folder. You drop in a file called "File1". So it renames it "sometext File1". Then it sees this new file called "sometext File1" and thinks "Hey, this is a new file - I'll call it 'sometext sometext File1' because I have to rename every new file." Then it sees this new file called "sometext sometext File1" and thinks...
    You get the picture.
    (the .ds_store is a normally hidden database file which is getting revealed by the same process.)
    The solution is to move the files out of the renamer folder into a receiving folder after they have been renamed:
    Hope this helps,
    H

Maybe you are looking for