Sunday, April 28, 2024
133
rated 0 times [  133] [ 0]  / answers: 1 / hits: 683994  / 2 Years ago, fri, may 27, 2022, 11:59:52

I got a bunch of files in some directory (along with many other files) that I want to move.



Luckily, all the files I want to move contain a certain identifier in their names, so I can ls | grep IDENTIFIER to get the exact list of files to move.



But, how can I execute mv file /path/to/dest/folder/ at once, and not one by one (there's a lot of files to move)?


More From » command-line

 Answers
2

If you want to move ABC-IDENTIFIER-XYZ.ext or IDENTIFIER-XYZ.xml, you can use:



mv *IDENTIFIER* ~/YourPath/


* is a wildcard for zero or more characters, this means zero or more characters, followed by IDENTIFIER, followed by zero or more characters.



This will move all the files that contain the IDENTIFIER you specified.


[#34387] Saturday, May 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tionavocad

Total Points: 189
Total Questions: 101
Total Answers: 118

Location: Liechtenstein
Member since Wed, Dec 8, 2021
2 Years ago
;