Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I mass remove file prefixes in a Mac? For example, inside my folder, I have the following files:

img_sometext1.jpg
img_sometext2.jpg
...
img_sometext10.jpg

How do I remove img_?

share|improve this question

4 Answers 4

up vote 6 down vote accepted

The easiest solution might be to use the commercial A Better Finder Rename to achieve this.

For a free alternative, you can install the command-line rename utility:

  • install Xcode
  • install Homebrew
  • open Terminal.app and do brew install rename

You can now use, in the Terminal, either of:

rename -d img_ *
rename "s/^img_//" *

to strip away the prefix.

share|improve this answer
    
Awesome! I already had homebrew installed and your solution worked perfectly well. –  Propeller Mar 9 '12 at 5:08

You can use Automator's Rename Finder Items action:

  1. Start Automator, select Workflow, and add Get Specified Finder Items and Rename Finder Items from the library on the left to the workflow area on the right by double-clicking.

  2. Drag and drop the files you want to rename to the list in Get Specified Finder Items.

  3. Change Rename Finder Items to Replace Text as desired, and click the Run button.

Automator screenshot

Result after execution: Result

You can easily change this workflow to make it repeatable, e.g. with selected Finder items instead, and save it as Application or Service.

share|improve this answer

If you want an elegant, easy, and feature-rich solution, I personally like Name Mangler.

Used to be called File List and was free, now it costs $10. May be a little steep for some people, but it's well-written and extremely functional if you don't want to get into the command-line methods of doing this.

share|improve this answer

You can use the command line below,

find /path -name 'prefix*' -type f -delete

or, in your case,

find ./ -name 'img_sometext*' -type f -delete

share|improve this answer
    
-1 OP wants to rename the files, and not to delete them! –  mpy Jul 23 at 6:32

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.