Monday, March 09, 2009

Automator.. and mugging

You know those irritating '%20' stuff you get when you download files online? Well, I get it all the time at my university's eLearning portal, and when I wanted to study them before my test last week, files with names such as 'Module%206%20Middleware%20Technology%20Part%203' just wasn't going to make things any easier.

So I came up with a simple workflow in Apple's Automator and just felt like sharing. Consider this a super simple introduction to Automator=)

(For those who don't want to bother about doing it yourself, download the workflow at http://www.easy-share.com/1903953677/MagiClean%20.zip, and install in Library/Workflows/Applications/Finder)

Fire up Automator and you should see something like this:
From the Actions library on the top left, go to Library > Files & Folders, then drag out 'Get specified Finder items' to the right-hand pane.
Then scroll down and drag out 'Rename Finder items' below the previous action and fill in the options as shown below: Note: Under 'Replace', I typed in a space so you can't really see it here. You can also replace it with anything you prefer i.e. underscore, dash, etc

Finally, and most importantly, go to 'File > Save As Plug-in...' and save it as a plugin for Finder:
Quit Automator and you're done!

So any time you want to magically transform your filename, select all your files that you want to clean up, Right-click > More > Automator > MagiClean%20

And your filenames are now loads more readable!=)

Do experiment further with Automator and you'll see how useful it can be!

3 comments:

klaw said...

let me contribute a bit as well.. save the following as rename.vbs

and put it in the root directory of all the files that you want to rename. double click the vbs file, it should rename all the files in the root directory recursively (including all sub directories)

--copy---

Sub RenameFile(ByVal start)
Dim fso, f, fc, f1, f2, fd
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(start)
Set fc = f.Files
For Each f1 in fc
If f1.name <> "rename.vbs" Then
fso.MoveFile f1.path, Replace(f1.path, "%20", " ")
End If
Next
Set fd = f.SubFolders
For Each f2 in fd
RenameFile(f2.path)
Next
End Sub

RenameFile(".")

--end--

Cheng Pei said...

Haha thanks, tried and works great. Note that it's windows only (sorry windows users, I tend to neglect you=p)

Mohamad Fauzi said...

Wah lol....I'm speechless.