I'm just trying to copy the folder present in /home/black/Desktop/linux
to another folder present in /home/black/Desktop/ubuntu
now what i did.cd /home/black/Desktop/linux
now am there in linux folder in Desktop.
Then:
cp -r linux/ /home/black/Desktop/ubuntu
no such file or directory
Between when i am copying the content from linux folder like .txt file to another directory i can do that smoothly. so y use -r when copying folder?
Try this:
If there is a specific folder in the
linux
folder, you will need to add that folder to the source path. The source and destination paths need to be separated by a space. Your original command likely failed because you you used a source path oflinux/
and the trailing/
leaves an undefined path in the command. Using the-r
invokes recursive copying to copy all the contents of the directory.I prefer copying with this format:
cp [OPTION]... -t TARGET_FOLDER SOURCE_FILE_OR_FOLDERS...
e.g.1 Copying a single directory/folder:
e.g.2 Copying multiple directories:
e.g.3 Copying multiple directories and files:
e.g.4 Copying multiple directories and files:
with parameters
r
andt
for recursive and verbosity options.A little about the switches:
-r
for recursive copy (copy folder all contents including sub-directory structure and contents)-u
copy only when the SOURCE file is newer than the destination file or when the destination file is missing-v
outputs the copy operations performed.