LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   command to copy a directory (https://www.linuxquestions.org/questions/linux-newbie-8/command-to-copy-a-directory-669782/)

ceantuco 09-13-2008 09:14 PM

command to copy a directory
 
Hi Guys,

I was trying to copy a directory from one place to the other one (local HD) but the cp command doesn't allow me to copy the entire directory. I was able to copy files from there but no directories.
Thanks

sasho 09-13-2008 09:22 PM

cp -r will copy recursively

ceantuco 09-13-2008 10:44 PM

Thanks! the problem wasn't the command I was typing, it was the directory name (upper case/spaces and numbers) Thanks again!

lipun4u 09-13-2008 11:44 PM

use tab

lets say the directory is in /root with name "gappu pad"
type

cp -r /root/gap<press tab here> target

Reasa 09-14-2008 04:56 PM

for spaces in names i usually put them "into brackets".

Ashok_mittal 09-17-2008 04:03 AM

Quote:

Originally Posted by ceantuco (Post 3279718)
Thanks! the problem wasn't the command I was typing, it was the directory name (upper case/spaces and numbers) Thanks again!

directory you want to copy is abc/ target is xyz/

cp -r abc/ xyz/

or if u want to copy a entire directory content then go in the directroy liks

cd qwe/

cp -r * xyz/

bob_man_uk 09-17-2008 04:09 AM

directories with spaces "should" have a \ before the space for example


Code:

cp -r silly\ sally/
and this is what the direcotry layout looks like


Code:

root@debian:/home/mgilbert# ls
core      Desktop  Documents  Music    Public      smb4k      Videos
core.9688  dev      hdd        Pictures  silly sally  Templates
root@debian:/home/mgilbert#



All times are GMT -5. The time now is 06:32 AM.