Skip to content

Instantly share code, notes, and snippets.

@u8sand
Created March 31, 2016 13:28
Show Gist options
  • Save u8sand/65c6c891c51b88396681e7399d30d3f3 to your computer and use it in GitHub Desktop.
Save u8sand/65c6c891c51b88396681e7399d30d3f3 to your computer and use it in GitHub Desktop.
Rename files to lowercase
#!/bin/bash
# e.g find . -type f -exec bash rn.sh {} \;
p=$(dirname "$1")
f=$(basename "$1")
l=${f,,}
mv "$p/$f" "$p/$l.tmp"
sync
mv "$p/$l.tmp" "$p/$l"
sync
echo "$p/$l"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment