Can you "find and replace" folder names and names within folders?

in Genius Bar edited January 2014
For my work I recently purchased a NAS iomega storarge hard drive to park our archive and photo/art libraries. The problem is that it won't let me copy any folders or files that have a / in them. Almost everyone of our files and folders are dated using the backslash! Is there a "Find and replace" type script or action that can help me? I am not all that famillier with action scripts, but willing to try anything.

Thanks in advance!


  • Reply 1 of 6
    chuckerchucker Posts: 5,089member
    A Better Finder Rename would work.

    Also, sounds like Automator might do the trick.
  • Reply 2 of 6
    chuckerchucker Posts: 5,089member
    Yeah, seems to me a Get Selected Finder Items; Rename Finder Items (Replace Text in Finder Item Names) should work.
  • Reply 3 of 6

    Originally posted by Chucker

    A Better Finder Rename would work.

    Also, sounds like Automator might do the trick.

    Thanks Chucker-

    I have never used Automator. If you have a quick step-by-step to point me to that would be great, but I will try to figure it out on my own. If that doesn't work, I'll buy the better renamer program.

    Thanks again for the quick responce!

  • Reply 4 of 6
    chuckerchucker Posts: 5,089member
    It's actually quite straightforward in this case.

    1) Open the Automator application. You'll find it right in /Applications.

    2) You'll see a Library listing various applications/contexts and workflows, a list of Actions next to it, an explanation pane, and, most prominently, a pane where your workflow ends up in. There's also a search field and buttons to run and stop.

    3) Type "select" into the search field. You'll see the Finder icon in the list of actions, with an action called "Get Selected Finder Items". Drag and drop that one into your workflow. You'll now have a workflow item labelled "1". Note the "Files/Folders" bit in its bottom right, and the X button to remove it (don't click) in the top right. "Files/Folders" being at the bottom means: this action results in Files or Folders being passed along. That's what we want: we want to do something with Files or Folders.

    4) Now, type "rename" into the search field. You'll find "Rename Finder Items", which is what we need next. Drag it into the workflow, underneath (not above!) your previously added "Get Selected Finder Items" item. You'll get a sheet warning you that this results in names being permanently changed, and offering to backup the original names. You probably don't want this, so choose "Don't Add".

    5) You now have two items in your workflow. The second one is much more complex than the first, actually offering you many options. Notice, at first, that the "Files/Folders" we looked at before now has an arrow underneath which ties right into another "Files/Folders". What this means is that the Files and/or Folders that result from the first action are being used as input for the second. In other words, when you run the workflow, whatever items you have selected in Finder will be used for this rename action.

    6) Instead of "Add Date or Time", you want "Replace Text". This gives you a set of simple find and replace options. The "Ignore Case" option probably doesn't matter in this case, since the "/" character doesn't exactly exist in upper or lower case variations, but turn it off anyway for good measure. Then, for Find:, type in "/" (without the quotes, of course), and for Replace:, use maybe the pipe character: |

    7) You're done. No, seriously, that's it. Go to Finder and select a few files and/or folders with a slash in their names. Make backups, if you want, by duplicating. Then go back to Automator and click Run. There, names changed.

    You can save this workflow using File -> Save As?, and you could put it, say, in the Dock, and then always invoke it whenever you have selected a few Finder items you want renamed to have slashes replaced with pipes.
  • Reply 5 of 6
    Awsome! At first it wasn't working because the folders were over our network, not on my desktop. But I tried it on folders on my desktop so it should work fine.

  • Reply 6 of 6
    meelashmeelash Posts: 1,045member
    I am not sure and not at home where I could try this out right now, but I believe if you go in Apple script preferences or something in the System preferences then you can turn on the Apple Script menu in the menu bar. Then, one of the included "example" apple scripts in the Finder sub-menu will find and replace names.

    I think...Maybe...
Sign In or Register to comment.