Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Copying all files from one directory to another?

Posted on 2004-08-05
3
286 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linux VM 6 101
ftp to port 21 4 54
Run Secure WMI query from CentOS 5 83
Linux mount of Windows Shared Now Fails 8 76
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

828 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