-
-
Save wsoyka/dd98c19cf806667c07c50cca37db3423 to your computer and use it in GitHub Desktop.
Rename all files extensions to lowercase with zsh, ignoring directories.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rename all files extensions to lowercase with zsh, ignoring directories. | |
#load zmv | |
autoload -U zmv | |
zmv -Qvn '(**/)(*).(*)(.D)' '$1$2.${(L)3}' | |
Whats happening here: | |
-Q enable globs (for directory matching later on) | |
-vn verbose output, no executuion - remove these after checking this command does what you want it to | |
(**/) go through all subdirectories, target saved in $1 | |
(*).(*) filename up to last point - $2 '.' filextension after last point - $3 | |
(.D) ignore directories | |
${(L)3} make $3 lowercase | |
Since $3 will only target stuff after the last dot, this wont work for double extenstions like .TAR.GZ (would become .TAR.gz) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment