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)?
Best Answer
If you want to move
ABC-IDENTIFIER-XYZ.ext
orIDENTIFIER-XYZ.xml
, you can use:*
is a wildcard for zero or more characters, this means zero or more characters, followed byIDENTIFIER
, followed by zero or more characters.This will move all the files that contain the
IDENTIFIER
you specified.