Unix: rename files to lowercase

It’s very simple to rename the files to lowercase/uppercase using awk:

Lowercase
[cc lang=”bash”]
ls -1rt | awk ‘{ printf(“mv %s %s\n”, $0, tolower($0)) | “sh” } END { close(“sh”) }’
[/cc]

Uppercase
[cc lang=”bash”]
ls -1rt | awk ‘{ printf(“mv %s %s\n”, $0, toupper($0)) | “sh” } END { close(“sh”) }’
[/cc]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.