I was copying a movie (.mkv) file from pen drive to PC (Ubuntu) and it showed error while copying, so I had to cancel it. The file size was 3.2 GB. Now the file on Pen drive still shows size 3.2 GB but there's also a file on my PC of 311 MB. Did cancelling it destroyed that 311 MB data from 3.2 GB?

In simple words, is my file on pen drive is still same as before copying and cancelling?


No, canceling a copy or a move of a file does not modify the original file.

Your 3.2 GB file is still intact as it was before the move/copy.

In fact, when you copy a file from one location to another, the original file is not modified in any way whether the copy was finished, canceled or interrupted.

And when you move a file to a different filesystem (for example, in your case from your pen drive to your PC's internal drive), the file will be copied first (as if you are doing a normal copy), and only then is the original deleted. So in this case, the original file doesn't get modified either if the move was canceled or interrupted.

  • 2
    Are you sure about the second point? Moving a (huge) file within a filesystem is usually a matter of < 1 second, so I doubt it'll be actually copied. But you are probably right for moving files between filesystems. And since the OP used a pen, the file is moved between filesystems here. – Jost Aug 11 '17 at 12:53
  • @Jost yeah, I only meant moving them between file systems, I'll clarify it in my answer. Thanks for the note. – Dan Aug 11 '17 at 13:02
  • 2
    @Jost he is correct. topic is about moving from/to a stick to/from ubuntu. On the same partitions what changes is not the file but the directory content (and that is flipping a node so almost instant) – Rinzwind Aug 11 '17 at 13:08
  • @Jost The answer is correct. Within the same filesystem, mv just calls rename() whereas while mv-ing between filesystems, the content is first copied by read()s-write()s, only after these become successful, the file is unlink()-ed from source directory. – heemayl Aug 11 '17 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.