multi copy from a directory to another directory

dotKer

Member
Credits
0
I like to copy of multi directoires and files in a directory to another directory.

The would-be shell script below doesn't work but I hope it shows what I want.
Code:
would-be shell script

/directory1/(dir1, dir2, file1, file2) /directory2/(dir1, dir2, file1, file2)
 


JasKinasis

Well-Known Member
Credits
566
If you only want specific items from directory 1, you could do something like this:
Code:
cp -r /path/to/directory1/{dir1,dir2,file1,file2} /path/to/directory2/
That will recursively copy the specified subdirectories and files from directory 1 into directory2.

Alternatively - if you want all of the contents of directory1 copied into directory2, you would do this:
Code:
cp -r /path/to/directory1/* /path/to/directory2/
EDIT:
NOTE: Replace all instances of /path/to/ with the actual path to the directories.
 


Members online


Top