-2

I have multiple zip files in a folder with names like below:

"abc.zip-20181002084936558425"

How to rename all of them with one command to get result like below:

"abc-20181002084936558425.zip"

I want the timestamp before the extension for multiple filenames. Now every file has different timestamp so renaming should consider that. Can I rename multiple files like this using single command.

1 Answers1

1

Providing your file are really all with the same name convention and you being in the right directory :

for i in *.zip-*; do newName=${i//.zip};mv $i $newName".zip";done

should do the trick.

Andre Gelinas
  • 912
  • 1
  • 8
  • 10