What happens if the Linux mv command is interrupted? Say, I'm moving a whole directory to some other place and interrupt it while it's moving. Will the source directory still be untouched?
|
feedback
|
|
If you move a directory on the same file system you only move the directory entry from one location in the file system to another one. E.g. If you move the directory from one file system to another the files are transferred one-by-one (as Ignacio mentions in his answer), i.e. if you interrupt the | |||||||||||||
feedback
|
|
No. mv operates object by object, so objects that have already been processed will be removed from the source. | |||
|
feedback
|
|
Definitely no. The move is made object by object. Hence, the object moved to the destination up to the point of interrupt shall not exist in the source any more. If mv was issued for a large file (between different) and it has been interrupted then the source will be intact. On the target you will see an incomplete file up to the point of interruption. You can however restore the mv with the same command and the process will continue. | |||
|
feedback
|
|
The GNU implementation iterates over the arguments on the command line, attempts to rename first, and, if that fails, recursively copies and then recursively deletes the source. So
will delete a before copying b, and will not start deleting anything in a before the destination copy is complete. Note that this applies to the GNU implementation only. To clarify: if a is a directory containing d and e, and b is a file, the order will be
| |||||
feedback
|
