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>
  • Thanks Peter. I'm trying to copy three sub-directories within rails_projects to my home directory haseebjaved. When I issue the following command: cp -r ~/Desktop/rails_projects haseebjaved , the command effectively copies the three subdirectories from rails_projects to haseebjaved and makes a new folder named haseebjaved in my home directory haseebjaved. What I want is the directory rails_projects to show up under my home directory haseebjaved just like other folders such as Downloads, Desktop, etc. – hjaved Mar 21 '12 at 0:45
  • I'm using the search function with Finder now and it's much better but I don't see my home directory there in Favorites or anywhere else. Very new to Mac OS X and Rails. – hjaved Mar 21 '12 at 0:46
  • cp -r ~/Desktop/rails_projects ~ is what you want – Andy Friese Mar 21 '12 at 0:49 
  • 4
    Here is the manual from cp-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 
  • 1
    Just two cents about copy folders from command line: ditto command ss64.com/osx/ditto.html PS. Unlike cp -R, if the destination folder already exists, the existing contents will be merged with the contents of the folder being copied. – Alexander Hramov Feb 6 '15 at 7:00 


cp -R "/src/project 1/App" "/src/project 2"


Using quotes will cater for spaces in the directory names

cp -R "/src/project 1/App" "/src/project 2"

If the App directory is specified in the destination directory:

cp -R "/src/project 1/App" "/src/project 2/App"

and "/src/project 2/App" already exists the result will be "/src/project 2/App/App"

Best not to specify the directory copied in the destination so that the command can be repeated over and over with the expected result.

Inside a bash script:

cp -R "${1}/App" "${2}"