2

I need to bulk rename these files:

file001 ().mp4
file002 ().mp4
file003 ().mp4

Rename to:

file001.mp4
file002.mp4
file003.mp4

I tried this command, rename "s/ ()//g" * but it didn't work.

2

rename accepts regular expressions as patterns:

DESCRIPTION
       "rename" renames the filenames supplied according to the rule specified
       as the first argument.  The perlexpr argument is a Perl expression

In your example your regular expression for matching is () but the parentheses are special characters in such expressions and need to escaped like \(\)

  • thanks but I would appreciate if you told me the full and right command for this issue – Misagh Karimi Dec 16 '16 at 14:47
  • i explained it pretty well the command would be s/ \(\)//g – Kristopher Ives Dec 16 '16 at 14:53
0

You can use pyrenamer (at least you won't worry about regex)

1. Installation

sudo apt-get install pyrenamer

2. Usage

(The numbers in square brackets refer to the image at the bottom of this answer)

  1. Open up pyrenamer and browse to the location of your files. 1
  2. Go to the Substitutions tab [2]
  3. Select Replace then set () in the first text box, leave the second empty [3]
  4. Click on preview [4]
  5. Confirm whether that's what you exactly want [5]
  6. Finally click rename to actually rename the files [6]

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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