Skip to content
Advertisement

linux rename multiple files using rename

I have a bunch of files (several thousand) called:

output.temp.1.csv output.temp.2.csv output.temp.3.csv etc.

I would like them all to be renamed but having the .temp removed

output.1.csv output.2.csv output.3.csv etc.

I think rename is what i need but not sure how to go about doing it

I tried:

rename 'output.temp' 'output', output.temp.*.csv

But this didn’t work…

Any advice on how to get this changed?

Thanks…

Advertisement

Answer

You can use:

rename 's/output.temp/output/' output.temp.*.csv

This will rename 3 files to:

output.1.csv
output.2.csv
output.3.csv
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement