Search code examples
linuxmv

What happens when a multiple file transfer is interrupted?


I used mv to move some files from /source_dir/ to /target_dir/, which looked like: mv /source_dir/*some_regex* /target_dir/.

One of the files which started to move, file1, is now in both target_dir and source_dir.

target_dir/file1 weighs considerably less than source_dir/file1. My question is: Is source_dir/file1 broken? Is it unaffected (in which case I can delete target_dir/file1 and rerun the mv.


Solution

  • The source file is removed after copying is finished. Therefore, source file stays unaffected until the operation is completed.

    If moving on the same filesystem, a different mechanism is used, where the data stays in place.