1834047 Members
2541 Online
110063 Solutions
New Discussion

cpio

 
SAM_24
Frequent Advisor

cpio

Hi,

Using cpio when I copy data(exists in destination already) from one file system to another I get error message "Cannot link error no 17. I am using options -pdmluv.
Is there any option which says to suppress this error message.

When I copy first time ( no data in destination ) I don't get error message. I need to copy data multiple times.We don't want to see error message when we copy second time or onwards.

Thanks.
Never quit
4 REPLIES 4
Bill Hassell
Honored Contributor

Re: cpio

errno 17 = file exists, or in this case, the link already exists. You can suppress the error message with 2>/dev/null but this eliminates all error messages (like filesystem full, etc) which may not be a good thing...you could look over the destination and remove links prior to copying to eliminate the error message.


Bill Hassell, sysadmin
RolandH
Honored Contributor

Re: cpio

You try to copy a link. So the first time the link is not there and is copied without the error message. Then you copy second time and you get a error message, because the link is already there.

use this instead:
find . | cpio -pvumod|(cd ; cpio -pumid)

Roland

Sometimes you lose and sometimes the others win
Keith Bevan_1
Trusted Contributor

Re: cpio

Hi,

Error 17 is reported as the 'l' option in cpio tries to restore the symbolic link that already exists.

If you are looking to restore the data for the symbolic links rather than the links themselves you could try the 'L' option that does the following :-

-L, (copy the files that they point to
instead of copying the links).

Haven't tried it myself but worth considering.

Hope this helps.

Keith
You are either part of the solution or part of the problem
Bill Hassell
Honored Contributor

Re: cpio

Be careful with the L option. The reason links exists is to provide another name for the same file. If the link is converted to a real file, then the files are now separate and changes made to one will not appear in the other.


Bill Hassell, sysadmin