1833752 Members
2562 Online
110063 Solutions
New Discussion

Re: link failed

 
Donald Thaler
Super Advisor

link failed

what causes this error when doing a simple copy
link failed: aoqdesg.plx: File exists

this was the command
cp *.plx /u01/app/sghe/inb/LCCC/fmx/base/

the copy worked all the .plx's were copied ??
3 REPLIES 3
Ramesh S
Esteemed Contributor

Re: link failed

Hi

Seems "aoqdesg.plx" already exist on the target directory.

Or Any soft link / hard link for the file aoqdesg.plx is already there in target directory.

Thanks & Regards

Ramesh
TTr
Honored Contributor

Re: link failed

The "cp" command would normally copy over an existing file or link with the same name.

SOmething is wrong with the "aoqdesg.plx" file in the destination folder. The "link failed" message means that the name aoqdesg.plx can not be created in the destination folder as a directory entry and not as file contents.

Can you post the output
ll -i /u01/app/sghe/inb/LCCC/fmx/base/aoqdesg.plx

Are there any errors (inode related) in the syslog?

You can do a compare of the source and target directories visually and using diff and dircmp.
Steven Schweda
Honored Contributor

Re: link failed

"cp" is generally not a good way to duplicate
the contents of a directory. The results can
depend too much on the form of the files
being copied (and whose "cp" you're using).
For example:

td191> ls -l
total 16
-rw-rw-rw- 2 antinode 513 28 Feb 15 01:52 file.hln
lrwxrwxrwx 1 antinode 513 8 Feb 15 02:02 file.sln -> file.txt
-rw-rw-rw- 2 antinode 513 28 Feb 15 01:52 file.txt

td191> cp -p * ../dir2

td191> ls -l ../dir2
total 24
-rw-rw-rw- 3 antinode 513 28 Feb 15 01:52 file.hln
-rw-rw-rw- 3 antinode 513 28 Feb 15 01:52 file.sln
-rw-rw-rw- 3 antinode 513 28 Feb 15 01:52 file.txt

And a second time:

td191> cp -p * ../dir2
link failed: file.sln: File exists
link failed: file.txt: File exists

On the other hand (after emptying dir2):

td191> tar cf - . | ( cd ../dir2 ; tar xf - )

td191> ls -l ../dir2
total 16
-rw-rw-rw- 2 antinode 513 28 Feb 15 01:52 file.hln
lrwxrwxrwx 1 antinode 513 8 Feb 15 02:04 file.sln -> file.txt
-rw-rw-rw- 2 antinode 513 28 Feb 15 01:52 file.txt

I prefer the latter result.