Linux: remove file extensions for multiple files

后端 未结 9 1921
甜味超标
甜味超标 2020-12-04 16:43

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

I found that

rename .old .new *.old
<
相关标签:
9条回答
  • 2020-12-04 17:13

    In Fish, you can do

    for file in *.old
          touch (basename "$file" .old).new
    end
    
    0 讨论(0)
  • 2020-12-04 17:14

    The Perl version of rename can remove an extension as follows:

    rename 's/\.txt$//' *.txt
    

    This could be combined with find in order to also do sub-folders.

    0 讨论(0)
  • 2020-12-04 17:18

    execute in bash linux

    for i in *;do mv ${i} ${i/%.pdf/} ;done
    
    0 讨论(0)
提交回复
热议问题