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.

I have a directory (Linux user) with a number of files which contain an added [!] to the end of each file name so that each file reads out as:

  • foo something [!].zip
  • bar something [!].zip
  • helloworld [!].zip
  • etc.

What is the quickest way to batch rename these to remove the ending [!] character combination from these file names?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can use the rename tool like this

rename 's/\ \[\!\]//' *.zip

I recommend that you first add the -n switch, which causes rename to just show what it will do, but not rename any files.

rename -n 's/\ \[\!\]//' *.zip

Note that this will only remove the first occurence of [!] in the filename, only if it is preceded by a space, and regardless of whether it is at the end of the filename or not.

share|improve this answer

Easiest way might be to use the Krusader file manager and the Multi Rename tool.

This will allow you to rename multiple files, even recursing down the directory structure.

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.