Skip to main content
1 of 3
Sagar
  • 446
  • 3
  • 11

Here is the shell script that will help you. You can choose different date. I used current date. Save the shell script as myrename.sh and call it ./myrename.sh dirname. Where dirname is the name of directory in which files will be affected.
#!/bin/bash for i in `ls $1 | grep -E '[0-9]{4}-[0-9]{2}-[0-9]{2}'` do x=`echo $i | grep -oE '[0-9]{4}-[0-9]{2}-[0-9]{2}'` y=`echo $i | sed "s/$x/$(date +%F)/g"` mv $1/$i $1/$y 2>/dev/null #incase if old date is same as current date done

Sagar
  • 446
  • 3
  • 11