Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

You must log in to answer this question.

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