Thursday, May 2, 2024
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 14239  / 2 Years ago, sat, july 16, 2022, 6:55:44

I have a directory with about 10 files and I want to remove the last three characters from the names of all of these files. Anyone know a terminal command that can do this?



And separately, how would I change the characters in the names of all these files to lowercase?


More From » command-line

 Answers
6

Remove last three characters from all filenames in current directory:



rename 's/...$//' *


Change the characters in the names of all files from current directory to lowercase:



rename 'y/A-Z/a-z/' *


For more info see man rename.


[#28245] Monday, July 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
atetamme

Total Points: 11
Total Questions: 121
Total Answers: 109

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago
;