Prevent deletion of file when it is being copied

sam tygier samtygier at
Fri Sep 28 09:13:32 UTC 2012

On 27/09/12 06:28, Emmet Hikory wrote:
> Nimit Shah wrote:
>> While copying a file from my computer to external disk, I by mistake
>> shift+deleted the file. But still the file transfer dialog showed that it
>> was continuing. At the end of the transfer it failed.
>> Hence i request you to add a check for file transfer before deleting the
>> file.
>     As much as this would be a lovely feature, I don't believe that it is
> something that we could implement in Ubuntu.

If a process on linux has opened a file (but not necessaries read it all into memory), and that file is then unlinked by rm or anything else, then the file should still be readable on disk until the process closes it. see for an example of undeleting a file with this method. this makes me think that this should just work (for the case of copying a single file with nautilus).

for copying multiple files, relying on this, would mean that you would have to open (but not read), all the files at the start. this could hit limits of the number of open files when copying many files

also, could this be done through file locking? it looks like linux might have the low level stuff needed to implement this.


More information about the Ubuntu-devel-discuss mailing list