Skip to content

Instantly share code, notes, and snippets.

@denniskupec
Created September 27, 2020 05:28
Show Gist options
  • Save denniskupec/7d2cf812c49b2ae1a8bf96a3b11c0fe3 to your computer and use it in GitHub Desktop.
Save denniskupec/7d2cf812c49b2ae1a8bf96a3b11c0fe3 to your computer and use it in GitHub Desktop.
Rename files to numbers ordered by modification time.
#!/bin/bash
n=1
for f in $(/bin/ls -tr); do
mv $f ${n}.${f##*.}
let n++
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment