Prevent deletion of file when it is being copied

Emmet Hikory persia at
Thu Sep 27 12:51:58 UTC 2012

Luis Mondesi wrote:
> Usually there are 2 solutions to these types of problems:
> 1. develop some complex code to deal with it
> 2. don't do the action to begin with
> Typically # 2 is the best answer. Writing complex code to avoid something that's obviously the wrong thing to do by the end user seems silly. The users simply have to wait until their files are copied.

    While often asking users to perform other actions can help with this
sort of thing, we can certainly try to help users avoid making mistakes.
I'm not sure how in this particular situation, given the vast number of
tools that copy or delete files making it potentially risky to suggest
that the problem is "solved", but generally if there is a technical
solution that can be done *once* to save every future user the effort
of learning any given lesson, this represents a vast savings in the
total human effort involved, and is hence a clear benefit.

> Why would you delete the file by shift-delete while is being copied!?

    While I'm not familiar with the details of the situation that started
this thread, a possible answer to this question could be demonstrated by
the following story:

   Alice and Bob share a laptop, and they find it convenient to have a
single account for both of them, and use different workspaces to run
their different programs.  One morning, Alice decides to copy her
collection of found audio recordings to their new network-enabled
stereo.  In the afternoon, Bob is using his workspace, and discovers
that there is not enough disk space for the video he shot the day
before, and asks if he can remove anything.  Alice, being sure that
she copied the files hours before, suggests her found audio files,
which had yet to complete delivery over their home network.  Bob
knows that simply removing the file from a directory will not free
space on the hard drive, so uses a shortcut to ensure that the
contents are purged upon deletion, freeing up the space for the video
clips.  As Bob is using his workspace, rather than Alice's, he will
not see the ongoing file transfer, so not be warned that what he is
doing is potentially dangerous.

    Yes, this is contrived, etc.  On the other hand, I suspect many
of us have managed to be both Alice and Bob in a scenario much like
that above when interrupted in the middle by some significant
distraction, or just a sufficient span of time.


More information about the Ubuntu-devel-discuss mailing list