Yes, absolutely! The mv command is very flexible and can move multiple files to a directory at once.
To do this, you list all the files you want to move, and specify the destination directory as the very last argument.
Syntax:
mv file1.txt file2.txt file3.txt destination_directory/
Examples:
-
Explicitly naming files:
If you havefile1.txtandfile2.txtand want to move both totestdir:mv file1.txt file2.txt testdir/ -
Using Wildcards (Patterns):
If you want to move all.txtfiles in your current folder totestdir, you can use the asterisk*wildcard:mv *.txt testdir/ -
Moving everything in a folder:
To move all files and subdirectories from the current location totestdir:mv * testdir/
Important Note: When moving multiple items, the final argument must be an existing directory. If it isn't, the command will return an error.
Give it a try in your terminal! It's a great way to save time when organizing your project files.