linux copy directory contents to another directory code example
Example 1: copy all files from a folder to another ubuntu
cp -a ./source/. ./dest/
Example 2: copy contents of directory to another directory linux
cp -a /source/. /dest/
Example 3: linux copy folder with files
cp -R path_to_source path_to_destination/
Example 4: linux copy directory permissions to another directory
chown --reference=otherfile thisfile
chmod --reference=otherfile thisfile
Example 5: how to copy directory to another directory in linux
cp -r <DIRECTORYPATH> <WHEREYOUWANTTOCOPYTO>
#for example
cp -r /home/thor/asia/india/bangalore /home/thor/
Example 6: how to copy file to another directory in linux
cp -r <FILEPATH> <WHEREYOUWANTTOCOPYTO>
#for example
cp -r /home/thor/asia.txt /home/thor/