Operating System - HP-UX
1753964 Members
7210 Online
108811 Solutions
New Discussion юеВ

cannot unlink: File exists

 
Jaap Westerbeek_2
Occasional Advisor

cannot unlink: File exists

I've got an NFS filesystem mounted.
I want to move a directory from the NFS to a local filesystem.
It moved most files, but I got a "permission denied" error on some files.
When I try to move the remaining files it gives me "cannot unlink: File exists"

Some info :
NFS server and client are HPUX 11.11
NFS patches have been installed on NFS server
No one is working on the NFS disk
I'm root :)

7 REPLIES 7
Kent Ostby
Honored Contributor

Re: cannot unlink: File exists

This generally means that the target file already exists.

For instance, if I'm moving a bunch of files from /home/fredsmith to /home/fsmith and the ownership is different, the "mv" would fail on files that already exist under /home/fsmith.

Take a look at one of the files that it doesn't want to move and then go to your target directory and see if the file already exists there.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Jaap Westerbeek_2
Occasional Advisor

Re: cannot unlink: File exists

Yes you are right. Most files had allready been moved.

Some files though do not exist in the target directory. It seems that if the destination-directory exists, it give me this error, allthough the files in that directory have not yet been moved.

If I go into the directory and move the files from there, it works. Problem is there are many many files and many subdirectories
Jaap Westerbeek_2
Occasional Advisor

Re: cannot unlink: File exists

is there any way to force-move the files even IF thay exist ?
Gopi Sekar
Honored Contributor

Re: cannot unlink: File exists


reason could be some wild card characters in the file name (most likely a space char). Also check whether any processes are using the file, then also you may get access violation error.

run mv with verbose output to check for any possible error message

Regards,
Gopi
Never Never Never Giveup
Jaap Westerbeek_2
Occasional Advisor

Re: cannot unlink: File exists

No files are in use
No wildcards are used in filenames

How do I mv with verbose logging ?
Gopi Sekar
Honored Contributor

Re: cannot unlink: File exists


for force move you can mv -f

to verbose output you can use mv -v

for more options check man mv

Regards,
Gopi
Never Never Never Giveup
Jaap Westerbeek_2
Occasional Advisor

Re: cannot unlink: File exists

mv -v doesn't work ?
mv -f still gives an error : cannot unlink : File exists