Operating System - HP-UX
1820561 Members
2036 Online
109626 Solutions
New Discussion юеВ

Can cp fail with a deleted dest file?

 
Wagner_6
Occasional Contributor

Can cp fail with a deleted dest file?

Hello

I try to ask again. Is it never possible that the cp command fails with a deleted dest file?
I think this happed in once in my batch job, because the partition is nearly full.
Urs
9 REPLIES 9
Pete Randall
Outstanding Contributor

Re: Can cp fail with a deleted dest file?

Hi Wagner,

As I mentioned, your cp command fails because the "partition" filled. Because the cp was unable to complete, the file is not there.

Pete

Pete
Paula J Frazer-Campbell
Honored Contributor

Re: Can cp fail with a deleted dest file?

Hi

If I understand your question correctly then cp will fail if the destination becomes full during the copy and the file it fails on will be zero bytes at the destination.


Paula
If you can spell SysAdmin then you is one - anon
Ravi_8
Honored Contributor

Re: Can cp fail with a deleted dest file?

Hi Wagner

as per your previous post, cp is failing due to insufficient space. I suggest you to use link(ln) instead of cp which saves you the space
never give up
T G Manikandan
Honored Contributor

Re: Can cp fail with a deleted dest file?

cp does not delete the desination file.
probably cp is failing because of lack of space in the file system.

Only mv command works like that.It does not write all the file to the destination unless everything is moved.

Thanks
Pete Randall
Outstanding Contributor

Re: Can cp fail with a deleted dest file?

Wagner,

First, you don't need to open a new question everytime. You can reply to the original to continue the thread.

Second, are you saying that you did "cp /home/mydir/filea /home/hisdir/fileb" and filea disappeared?

Pete

Pete
Wagner_6
Occasional Contributor

Re: Can cp fail with a deleted dest file?

In cp /home/mydir/filea /home/hisdir/fileb" and the existing fileb disappeared.

This is what I want to say.
Urs
Paula J Frazer-Campbell
Honored Contributor

Re: Can cp fail with a deleted dest file?

Hallo

Um Sachen klarzustellen seien Sie Sie sagend da?? Ihr "CP" Befehl ausfiel und Ihre Quellakte verschwand?
Oder da?? die Bestimmungsortakte verschwand.

Paula
If you can spell SysAdmin then you is one - anon
Wagner_6
Occasional Contributor

Re: Can cp fail with a deleted dest file?

The command "cp /home/mydir/filea /home/hisdir/fileb" failed and at the same time the already existing old fileb disappeared also.

This is what I want to say.
Urs
Pete Randall
Outstanding Contributor

Re: Can cp fail with a deleted dest file?

Wagner,

That makes sense. When the cp command started, the old file was replaced with what you were starting to copy. When the cp command failed, you were left with nothing.

Pete

Pete