Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 5193  / 2 Years ago, fri, december 24, 2021, 5:31:26

I do a mistake when trying to move files from one location to another. Now all files are moved, but there is a * concatenated at the end of all names.



How do I remove all *s from end of file names in command line?



Note: I'm working with an embedded system, there is not any Internet connection. Please provide solutions with no need to install new stuff.



Thanks in advance


More From » rename

 Answers
6

There is a command called (in an excess of originality) rename, that allows you to rename files using regular expressions.



In this case, you probably want to do:



rename 's/*//' files...


Which will remove the first * character found in each filename.



You can use rename -n to list the renames that will be performed without actually doing them if you're worried about the regex not being correct.


[#36201] Saturday, December 25, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ledeball

Total Points: 434
Total Questions: 121
Total Answers: 120

Location: Antigua and Barbuda
Member since Sat, Apr 24, 2021
3 Years ago
;