Recursively copying specific directories

I was wondering if it's possible to copy multiple specific directories recursively at once.

I know I can copy all sub-directories like so

cp -rp root/pass/dir/* root/other/dir/

But I'm wondering if I can recursively copy specific directories like with files

cp -p root/pass/dir/subdir/file{1,2,3}.php root/other/dir/

Lets say, in dir there are sub-directories subdir1, subdir2, subdir3.

Can I copy them recursively in the same way? e.g.

cp -rp root/pass/dir/subdir{1,2}/ root/other/dir/
5

1 Answer

Yes it will work. If company don't like you testing in production, they of course provide a test-system ? Or you can test in a vm on ypur pc, for instance in VirtualBox.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like