I have many files with .txt extension.
How to remove .txt extension for multiple files in linux?
I found that
rename .old .new *.old
substitutes .old extension to the .new
Also I want to do this for files in sub-folders.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
renameis slightly dangerous, since according to its manual page:It will happily do the wrong thing with filenames like
c.txt.parser.y.Here’s a solution using
findandbash:Keep in mind that this will break if a filename contains a newline (rare, but not impossible).
If you have GNU find, this is a more solid solution: