Friday, May 3, 2024
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 5209  / 3 Years ago, wed, june 30, 2021, 6:52:20

Suppose I have a folder with some 20 files (say, photos I took on a trip), and I want to rename them in one go, only there isn't any specific Perl expression I want to use (for example, if I'd like to add additional text to each name that's not part of the individual files' meta-data, such as descriptions and/or comments).



And suppose I can more easily generate a text file with what I want each file's name to be (or, if preferable, a 'before-and-after' sort of list).



Is there any way to apply the changes implied in that text list to the folder in question?


More From » command-line

 Answers
1

This looks like a job for xargs.



If your file is formatted like this:



old_file1 new_file1
old_file2 new_file2


then you can do xargs -a your_file -n 2 mv.


[#30370] Thursday, July 1, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bblerest

Total Points: 240
Total Questions: 119
Total Answers: 113

Location: Wallis and Futuna
Member since Mon, May 18, 2020
4 Years ago
;