Skip to content

Instantly share code, notes, and snippets.

@jorgeas80
Created March 20, 2020 10:00
Show Gist options
  • Save jorgeas80/f6167426f86cedfe96b5c98a90cdeeab to your computer and use it in GitHub Desktop.
Save jorgeas80/f6167426f86cedfe96b5c98a90cdeeab to your computer and use it in GitHub Desktop.
Batch rename files in a dir to a sequential name by file date
#!/bin/bash
a=1
for i in *.png; do
new=$(printf "%04d.png" "$a") #04 pad to length of 4
mv -i -- "$i" "$new"
let a=a+1
done
@jorgeas80
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment