Renaming files using terminal on ubuntu

October 13, 2015 by Sandeep Bhardwaj | Tags:


Suppose we have lots of lots file in a directory and we need to rename of modify the extension of all the file, then renaming one by one is pain and not a good idea as well.

If we want to rename all the files in directory in one shot then we can use below command.

Example:- Renaming all file with extension html to md.

find -L . -type f -name "*.html" -print0 | while IFS= read -r -d '' File_Name; do
    mv -- "$File_Name" "${File_Name%.html}.md"
done