Skip to content
Related Articles

Related Articles

Improve Article

Renaming All Files and Directory Names to Lowercase in Linux

  • Last Updated : 25 Mar, 2021

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  

Rename All Files and Directory Names to Lowercase in Linux

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:

Rename All Files and Directory Names to Lowercase in Linux

Now if you view the contents again you will see that all files/folders have been renamed.

Rename All Files and Directory Names to Lowercase in Linux

My Personal Notes arrow_drop_up
Recommended Articles
Page :