Is there something special with that directory or are you really just asking how to copy directories?
Copy recursively via CLI:
cp -R <sourcedir> <destdir>
If you're only seeing the files under the sourcedir
being copied (instead of sourcedir
as well), that's happening because you kept the trailing slash for sourcedir
:
cp -R <sourcedir>/ <destdir>
The above only copies the files and their directories inside of sourcedir
. Typically, you want to include the directory you're copying, so drop the trailing slash:
cp -R <sourcedir> <destdir>
cp -r ~/Desktop/rails_projects ~
is what you want – Andy Friese Mar 21 '12 at 0:49cp
:-R If source_file designates a directory, cp copies the directory and the entire subtree connected at that point. **If the source_file ends in a /, the contents of the directory are copied rather than the directory itself.** This option also causes symbolic links to be copied, rather than indirected through, and for cp to create special files rather than copying them as normal files. Created directories have the same mode as the corresponding source directory, unmodified by the process' umask.
– Xiao Oct 1 '14 at 5:40