Comments on: Rename – A Command Line Tool For Renaming Multiple Files in Linux https://www.tecmint.com/rename-multiple-files-in-linux/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Fri, 24 May 2024 06:35:48 +0000 hourly 1 By: Ravi Saive https://www.tecmint.com/rename-multiple-files-in-linux/comment-page-1/#comment-2134823 Mon, 12 Feb 2024 04:32:25 +0000 http://www.tecmint.com/?p=4393#comment-2134823 In reply to Philippe Moisan.

@Philippe,

The command rename 's/\b(\w)/\U$1/g' *.ext is is used to rename files with a specific extension in the current directory by modifying their names according to a regular expression pattern.

Let’s break down the components of the command:

  • s/ – Indicates a substitution operation.
  • \b – Represents a word boundary, ensuring that only the first character of each word is affected.
  • (\w) – Captures a word character and stores it in a capturing group.
  • \U$1 – Converts the captured character to uppercase.
  • /g – Global flag, meaning it applies the substitution globally (to all occurrences).
  • *.ext – Specifies the files to be renamed. In this case, it selects all files with the extension ".ext" in the current directory.
]]>
By: Philippe Moisan https://www.tecmint.com/rename-multiple-files-in-linux/comment-page-1/#comment-2134103 Sat, 10 Feb 2024 00:47:28 +0000 http://www.tecmint.com/?p=4393#comment-2134103 In reply to Ravi Saive.

I wish you would have explained how that specific command works.

Thanks!

]]>
By: Rocco Gilbralter https://www.tecmint.com/rename-multiple-files-in-linux/comment-page-1/#comment-1435663 Tue, 16 Feb 2021 20:22:14 +0000 http://www.tecmint.com/?p=4393#comment-1435663 For Centos 7:

To change all txt extension to html extension:

$ rename txt html *.txt
]]>
By: Akshay K https://www.tecmint.com/rename-multiple-files-in-linux/comment-page-1/#comment-1367584 Sun, 27 Sep 2020 07:14:16 +0000 http://www.tecmint.com/?p=4393#comment-1367584 Did the following to replace all txt files with html.

But the files are still in the txt extension.

# rename 's/\.txt$/\.html/' *.txt
]]>
By: M Rasheed https://www.tecmint.com/rename-multiple-files-in-linux/comment-page-1/#comment-1365104 Fri, 18 Sep 2020 08:07:44 +0000 http://www.tecmint.com/?p=4393#comment-1365104 Hi Everyone,

I have nearly 500 output files named from ‘xx00‘ to ‘xx 499‘, I want to change it for example to: ‘bb00‘ to ‘bb499‘.

Please I need your help

Sincerely
MRasheed

]]>