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
- bash: cls: command not found
- Execute .bin and .run file Ubuntu Linux
- Command to display epoch time Terminal
- How to ls command to output one entry per line [macOS/Linux/Bash]
- Terminal display next month Calendar
- The Date Command and its usage [Linux - Unix - macOS]
- zsh hello world example
- How to install python pip on Ubuntu using apt command
- ls command sort by file size [Linix/UNIX/macOS/bash]
- How to check uptime of Linux/Unix/macOS system/server using console command?
- How to remove or uninstall Java from Ubuntu using apt-get
- 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]
- Install Java Runtime Environment (Oracle or open JRE) on Ubuntu
- [Ubuntu] Search a package and versions using apt command
- How to change bash terminal prompt string and color
- Align left align text in Bootstrap - Bootstrap
- How to hide quick launch in SharePoint classic site - SharePoint
- Hide Navigation Bar from Android Screen Activity - Android
- FCM Messages Test Notification!!!! - Microsoft Teams, Google Hangouts push alert - News
- CentOS Cannot find a valid baseurl for repo base7x86_64 yum - HowTos