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? |
Maybe you wrong path
Quote:
|
Yes, both passweb10 and passweb10bkup directories exist in /test/tomcat/apache-tomcat-5.5.20/webapps.
|
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. |
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/
|
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 |
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 ?
|
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 |
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. |
All times are GMT -5. The time now is 04:07 PM. |