Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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).

share|improve this question
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 '13 at 0:19
    
It's Sickbeard. But I don't know if this issue is discussable on this forum :) –  Michiel Nov 13 '13 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 '13 at 12:44

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.