LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cp directory command (https://www.linuxquestions.org/questions/linux-newbie-8/cp-directory-command-232330/)

mark001 09-18-2004 10:42 PM

cp directory command
 
I tried to copy /home/user/abcd/ to /home/user/efgh/ using the cp comand, but received the message cp: omitting directory '/home/user/agcd/'. I tried several times with and without the back slash but still got the same message.

could anyone point out what is wrong with the command?

my distro is redhat 8

Thanks.

leonscape 09-18-2004 10:50 PM

try with -r option i.e.

cp -r /home/user/abcd/ /home/user/efgh/

cp copies files, -r tells copy to go recursivley to get all the files.

mark001 09-19-2004 12:07 AM

I type:-

cp -r /home/user/abcd/ /home/user/efgh/


IT WORKED.

Thanks leonscape.

excellent forum for newbies.

Kristijan 09-19-2004 12:12 AM

Just to point out mark001, it's always good to take a read over the manual pages.

So, using the above example;

Code:

man cp
Scroll down, and read through each switch and see if it does what you're looking for. So in the cp man page, you would have come across;

Code:

-R, -r, --recursive
              copy directories recursively

It just might be helpfull in the future for other commands.

Welcome to LQ.org :)

-Kristijan

akudewan 09-19-2004 01:50 AM

Okie, after six months of using linux, I never figured out how to copy directories from the terminal. I guess when I am told to RTFM, I really must RTFM. ;) Or I can just browse linuxforum :D

mirradric 09-19-2004 02:00 AM

The man pages contains lots of information about the commands and some even provide examples. You can learn a lot by going through them. Most questions are easily answer if you just look at the man page.

BTW some of the file managers/web browsers like Konquerer can handle man pages. just type
Code:

man:/cp
in the address bar of konquerer to view the man page of cp. man:/ gives you an index.
There's xman as well. Good for leisure browsing of the man pages...

Gosh, I must be way too bored...


All times are GMT -5. The time now is 01:39 PM.