LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-09-2010, 03:19 PM   #1
pgte3
Member
 
Registered: Aug 2004
Posts: 62

Rep: Reputation: 15
cp command


I am trying to use the cp command on a Unix system, reading the man pages for both Linux and Unix, the syntax and usage seem very close.

Running the command on the Unix system:

cp -R /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10 /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup

Where both /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10 and /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup exist, I get the following error.

cp: FSUM6829 building pathname "/test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup/passweb10/": EDC5129I No such file or direct
ory.

Any ideas what I am doing wrong?
 
Old 11-09-2010, 03:38 PM   #2
cparapat
LQ Newbie
 
Registered: Jun 2010
Location: Indonesia
Distribution: Mac OS X, Centos, OpenSuSE, Redhat, FreeBSD.
Posts: 26

Rep: Reputation: 0
Maybe you wrong path

Quote:
Originally Posted by pgte3 View Post
I am trying to use the cp command on a Unix system, reading the man pages for both Linux and Unix, the syntax and usage seem very close.

Running the command on the Unix system:

cp -R /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10 /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup

Where both /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10 and /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup exist, I get the following error.

cp: FSUM6829 building pathname "/test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup/passweb10/": EDC5129I No such file or direct
ory.

Any ideas what I am doing wrong?
How if you try, go with "cd /test/tomcat/apache-tomcat-5.5.20/webapps/" first. And do a list directory with "ls" command. See if there is the folder you mean is there ? Just want to make sure.
 
Old 11-09-2010, 03:45 PM   #3
pgte3
Member
 
Registered: Aug 2004
Posts: 62

Original Poster
Rep: Reputation: 15
Yes, both passweb10 and passweb10bkup directories exist in /test/tomcat/apache-tomcat-5.5.20/webapps.
 
Old 11-09-2010, 04:28 PM   #4
niiiro
Member
 
Registered: Feb 2010
Posts: 65

Rep: Reputation: 1
you could try using rsync command instead.. it goes like this:

rsync avrRp <source dir> <destination dir>

if rsync command wasn't found - install the rsync package.
 
Old 11-09-2010, 05:15 PM   #5
GazL
Senior Member
 
Registered: May 2008
Posts: 4,461
Blog Entries: 7

Rep: Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932Reputation: 1932
You need the "-T" option on the cp command, otherwise the copy will try and copy the source into the existing destination. i.e. you'll get a ./passweb10bkup/passweb10/ rather than a ./passweb10bkup/
 
Old 11-09-2010, 09:14 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
This might do it.
Code:
cp -R /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10/* /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup
--- rod.
 
Old 11-10-2010, 02:17 AM   #7
cparapat
LQ Newbie
 
Registered: Jun 2010
Location: Indonesia
Distribution: Mac OS X, Centos, OpenSuSE, Redhat, FreeBSD.
Posts: 26

Rep: Reputation: 0
Need Sudo

I think you need "sudo" command. Be "sudo cp -R ..". My opinion your directory destination is not have your permission to copy or updating the files. Is it true ?
 
Old 11-10-2010, 09:27 AM   #8
pgte3
Member
 
Registered: Aug 2004
Posts: 62

Original Poster
Rep: Reputation: 15
Thanks for your suggestions. Upon further investigation and reading the documentation, there seems to be a difference in the -r and -R option (see below).

-R (UNIX to UNIX only) "Clones" the source trees. cp copies all the files and subdirectories specified by source... into directory, making careful arrangements to duplicate special files (FIFO, character special). cp only follows symbolic link specified as source operand on the command line.

-r (UNIX to UNIX only) "Clones" the source trees, but makes no allowances for special files (FIFO, character special). Consequently, cp attempts to read from a device rather than duplicate the special file. This is similar to, but less useful than, the preferred -R.



Not exactly sure, what "special" files are, but this command seems to work:

cp -r /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10 /test/tomcat/apache-tomcat-5.5.20/webapps/passweb10bkup

Last edited by pgte3; 11-10-2010 at 12:56 PM.
 
Old 11-11-2010, 01:27 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Re special files: http://tldp.org/LDP/abs/html/fto.html
Loosely speaking, nearly everything in *nix is treated as a 'file', but only a few things like regular files & dirs are really 'just files'. See that page.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 12:21 PM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 02:31 PM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 03:14 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 07:30 PM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 03:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration