linux command line subfolder files batch rename that actually works

Stack Overflow Asked by fika_fika on September 18, 2020

In a folder with many subfolders, each containing mp4 files with names ending in foobar.mp4

How can I get rid of the suffix? I have tried:
find ./*/*.mp4 -type f -exec rename 's/foobar//' '{}' ;

One Answer

On surface, there is no need to use 'find', as the rename command has the ability to process list of file. In particular, possible to write

rename 's/foobar//' */*foobar.mp4

It's not clear from the OP what are the actual file names. The above command will rename 'foobar.mp4' to hidden file '.mp4', and the file 'x.foobar.mp4' to 'x..mp4'.

Answered by dash-o on September 18, 2020

Add your own answers!

Related Questions

Vimeo offline video playback issue

0  Asked on September 26, 2020 by ipatel


How to print data from a few arrays

3  Asked on September 25, 2020 by protodimbo


why this.key is not working properly in javacript?

2  Asked on September 25, 2020 by carlos-daniel


Pass the dynamic variable when button is pressed

1  Asked on September 19, 2020 by francy


detect a table part from entire image in python

5  Asked on September 19, 2020 by suji


C# Change number of decimals show, but it always skips a number

0  Asked on September 18, 2020 by theoverly


Custom font bold weight not working in Dompdf

1  Asked on September 17, 2020 by user13286


How to use has one through in laravel?

0  Asked on September 17, 2020 by ahz


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir