Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3619658
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:54:20+00:00 2026-05-18T22:54:20+00:00

I have many files with .txt extension. How to remove .txt extension for multiple

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:54:21+00:00Added an answer on May 18, 2026 at 10:54 pm

    rename is slightly dangerous, since according to its manual page:

    rename will rename the specified files by replacing the first occurrence of…

    It will happily do the wrong thing with filenames like c.txt.parser.y.

    Here’s a solution using find and bash:

    find -type f -name '*.txt' | while read f; do mv "$f" "${f%.txt}"; done
    

    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:

    find -type f -name '*.txt' -print0 | while read -d $'\0' f; do mv "$f" "${f%.txt}"; done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many tasks in .txt files in multiple sub folders. I am trying
I have multiple (many) files; each very large: file0.txt file1.txt file2.txt I do not
I am working in linux bash environment, and I have many files to edit,
I have many js files, with some naming convention. If there any tool that
I have many csv files that I need to clean ( replace ponctuation by
I have a list of text files file1.txt, file2.txt, file3.txt .. filen.txt that I
So I have some .txt files that have been formatted in a way that
I have a txt file that has many rows of lines I want to
For reasons undisclosed, suppose I have many identical README.txt files in a few dozen
I have 2 files: one (ranges.txt) with rows that contain 2 tab-delimited integers, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.