1

I've a kind of download-setup on my Mac and it does an excellent job downloading all the files I need. But for some reason the setup is renaming my files with "Title 9x88 Name". And I would like to drop this one "x" whenever a new files is detected in the directory.

Everything works perfect in Automator, except for the dropping the 1 letter.

enter image description here

I know Automator doesn't support wildcards, but is there any other way in how to drop the single X in the naming?
I'm open for every creative solution (shell scripts too).

3
  • 1
    Perhaps solving the root problem - why the file gets renamed with a 'x' in the middle - would be a better exercise than writing a kludgy work-around. Tell us what the download setup is and perhaps we can all tackle it together.
    – IconDaemon
    Nov 13, 2013 at 0:19
  • It's Sickbeard. But I don't know if this issue is discussable on this forum :)
    – Michiel
    Nov 13, 2013 at 10:42
  • Indeed ... perhaps not. Another solution would be to look at the utility app A Better Finder Rename, or learn a bit of regex and some shell scripting.
    – IconDaemon
    Nov 13, 2013 at 12:44

1 Answer 1

1

You could use a Run Shell Script action like this:

for f in *;do [[ $f =~ (.+ [0-9]+)x([0-9]+ .+) ]]&&mv "$f" "${BASH_REMATCH[1]}${BASH_REMATCH[2]}";done;exit 0

Or if the filenames don't contain other x characters, you could replace the script with for f in *;do mv "$f" "${f/x/}";done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .