Renaming All Files and Directory Names to Lowercase in Linux
Here we will see how to rename all files and directory names to lowercase in Linux. We can easily do it with some basic commands in Linux.
The below command can be used to view the contents of your directory.
$ find [directory_name] -depth
Here ‘priyanshu’ directory which has some sub-files/folders, has all files starting from uppercase letters:
$ find priyanshu -depth
Now we are going to use rename command to rename all files/folders in a given directory.
The below command will help us in renaming all files/folders
$ find priyanshu -depth | xargs -n 1 rename -v 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;
Here ‘priyanshu’ is directory name:
Now if you view the contents again you will see that all files/folders have been renamed.
Please Login to comment...