Solved

Copying all files from one directory to another?

Posted on 2004-08-05
3
287 Views
Last Modified: 2012-05-05
Suppose I am in the directory /gopi
And there are directories called as publicsource and publicdest in this /gopi directory.publicsource has some files in it whereas publicdest is empty directory.
 So how to copy all files from publicsource to publicdest from /gopi directory?
When I did,
cp -fR /gopi/publicsource /gopi/publicdest
the directory publicsource is itself getting copied to publicdest directory but i want only the files to be copied. So please help me.Thanks.
0
Comment
Question by:gopikrish
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 50 total points
ID: 11731860
Try:
 cp -fR /gopi/publicsource/* /gopi/publicdest

Or
 (cd  /gopi/publicsource; tar -cf -) | (cd  /gopi/publicdest; tar -xf -)



0
 

Author Comment

by:gopikrish
ID: 11732984
Ok and what does the following command do?
"cp -f /home/files/myfirstscript ."
0
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 11733075
> Ok and what does the following command do?
> "cp -f /home/files/myfirstscript ."

It makes a copy of  /home/files/myfirstscript  in the current directory (.).
The copy will have the same name as the original.  The -f switch  forces
any existing file in the current directory by that name to be overwritten.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question