Skip to content

Instantly share code, notes, and snippets.

@ivan-krukov
Created March 20, 2018 16:43
Show Gist options
  • Save ivan-krukov/6a8c1e0fd8d4961b664c8b952a7a9df2 to your computer and use it in GitHub Desktop.
Save ivan-krukov/6a8c1e0fd8d4961b664c8b952a7a9df2 to your computer and use it in GitHub Desktop.
Rename a bunch of files by zero padding
N=100
# create
for ((i = 1; i <= N; i++)); do
touch e-$i.csv
done
# rename
# note %04d - pad to 4 zeros
for ((i = 1; i <= N; i++)); do
mv e-$i.csv $(printf e-%04d.csv $i)
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment