Monday, January 11, 2016

Linux Directory Copy

Easy to use, slow to forget

Copy directory as well as subdirectories
The -R flag is to betoken a recursive copy

cp -R source-dir dst-dir

Note that this volition house source-dir/* inward dst-dir. If y'all desire to house source-dir/* in dst-dir/source-dir/* you must endure the next command:

mkdir /dst-dir/source-dir
cp -R source-dir dst-dir/source-dir

If y'all desire to deed all directories to sub-directory, inward instance y'all used the incorrect ascendency above, endure the following:

mv !(subdir) subdir