Another way to word the question is...
What happens when you mv
a directory between two disks?
Does it move one file after the other, or does it copy all files to destination, then then delete directory from the source?
If it copies everything first then deletes it, I can presume it is safe to force quit the mv
operation. Otherwise, it can be dangerous and cp
may be preferred for more intensive/larger moves.
When moving a directory, all of it's contents are copied before the original gets deleted. In other words, yes, it is safe to interrupt a
mv
command when moving a single source, such as a directory - even though it might have files and subdirectories, it's still a single source.Note that this is not the case when moving multiple sources with one command, such as:
In these examples, files will be moved one by one, so if you interrupt the command, you will not find the files that were already moved in their original place.
If you are interested in these details of how to do intensive or large move operations, there is a tool that will support all ideas you can think of. And then some.
rsync
It can be used to copy, move, synchronize files locally and remotely, in more ways anybody could ever need.
That comes with a back side:
man rsync
describes more options than anybody could ever read.It supports interrupted operations, continuations, partial transfers, difference based transfers - you name it.