1

So I have a bunch of files created with the name *FINAL.mkv and I have a (1st) script to remove all the files except files with FINAL.mkv

I need help renaming the new files back to the original *.mkv, any help appreciated!

Example file tree:

Stargate.mkv

StargateFINAL.mkv

Now after 1st script

StargateFINAL.mkv

What I want to end up with (this is in regard to recursive converting of videos)

Stargate.mkv
  • once answered perhaps the question can be re-worded to better help others – FreeSoftwareServers Aug 13 '15 at 6:57
  • 1
    Please add some examples of the current file names and your desired names from them .. – heemayl Aug 13 '15 at 6:58
2

Assuming the word FINAL comes only once in the filenames, you can do:

rename -n 's/FINAL//' *.mkv

This will do the dry run. After being sure you can carry out the operation :

rename 's/FINAL//' *.mkv

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.