LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to copy files from directory (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-copy-files-from-directory-777386/)

spartanz 12-22-2009 01:12 AM

how to copy files from directory
 
i have four directories and i want to copy only the files in the directory to a single directory, how can i do it with the cp command.

the directories names are dir1, dir2, dir3 and dir4 and i want only the files from these directories to a single directory called mainDir.

Thanks in advance

Kenichi Kato 12-22-2009 01:21 AM

OK, you could do this:

cp -p dir1/* mainDir/

then replace dir1 with dir2 & so on.

catkin 12-22-2009 01:22 AM

What did you learn in class? Which resources are you using to learn Linux commands? What have you tried so far? LQ does not exist to do your homework for you but will help you when you try yourself and get stuck.

EricTRA 12-22-2009 01:29 AM

Hello,

Just as catkin stated, we're not here to do your homework for you. This is basic stuff that you should know or can easily learn. Just check out the man page for cp and read up on Linux.

Code:

man cp
Here are some links to learn Linux commands.

http://www.pixelbeat.org/cmdline.html
http://www.oreillynet.com/linux/cmd/
http://ss64.com/bash/

Kind regards,

Eric


All times are GMT -5. The time now is 05:30 PM.