In order to copy a directory entirely from one location to another in Linux/Unix/Mac/Bash you can make use of the below command,Syntax:
cp -r source-dir destination-directory-location
cp : This is the copy utility used to copy file or files from source to a target file/files.
-r : This option is used if the source is a directory, when used with cp - it copies the directory and the entire subtree of the directory to the destination, note this will also copy the symbolic links.
source-dir: location of the source directory. Note that it should be a directory.
destination-directory-location: the target location where the directory (folder) needs to be copied.
Let's say I have a directory myApp on my Desktop location and I want to copy it to /Documents
cp -r myApp /Users/code2care/Documents
Note that if you do not provide -r parameter you will get an error saying cannot copy as the source is a directory.
code2care@mac Desktop % cp myApp /Users/code2care/Documents cp: myApp is a directory (not copied).
All the files and subfolders will get copied!
- How to install npm on Ubuntu
- ls command: sort files by name alphabetically A-Z or Z-A [Linux/Unix/macOS/Bash]
- Copy entire directory using Terminal Command [Linux, Mac, Bash]
- ls command sort by file size [Linix/UNIX/macOS/bash]
- [Ubuntu] Search a package and versions using apt command
- Execute .bin and .run file Ubuntu Linux
- How to change bash terminal prompt string and color
- zsh hello world example
- Install Java Runtime Environment (Oracle or open JRE) on Ubuntu
- How to remove or uninstall Java from Ubuntu using apt-get
- Chrome : When Adobe flash player has finished updating, reload this page to active it - Chrome
- Read Text file from SD Card : Android Programming - Android
- Android : Exception raised during rendering: action_bar API 22 - Android
- Find the location of Spotlight searched file - Mac-OS-X
- JSP Hello World Program Tutorial with Eclipse and Tomcat Server - Java
- SharePoint Server 2016 installation System Hardware requirements - SharePoint
- How to serialize-deserialize an object in java - Java
- The selected device is incompatible : Android Studio - Android-Studio
- Unbound classpath container: JRE System Library [JavaSE-1.7] - Java
- Bootstrap tooltip not working - Bootstrap
- osascript wants to make changes while Android Studio Installation on Mac OS X - Mac-OS-X
- -bash: startup.sh: command not found - Apache Tomcat 8 - Tomcat
- Android M cannot run app using play button : Android Studio - Android
- How to take Screenshot on Android device - Android