Is it better to always copy and delete, rather than move?

Posted by nbolton on Super User See other posts from Super User or by nbolton
Published on 2010-01-12T18:44:58Z Indexed on 2011/03/11 8:12 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

Generally speaking, I find myself panicking when I realise that if I cancel a file move, it could cause the target or source to be incomplete. This question applies to Windows and Unix-based platforms. I can never remember exactly how the move command works in either case. For example, if you're moving a directory; does it copy the entire directory, then delete it after, or does it copy then delete each file individually?

I always realise after typing something like, mv verybigdir dest that I really should have typed cp -R verybigdir dest && rm verybigdir (where the && operator only moves to the next command if the first was successful) -- or is this pointless? What happens exactly when I press Ctrl+C half way through a move? Likewise, what exactly happens on Windows when I press the cancel button?

I can't count the number of times I've moved something (the last time was when using svn) and had two directories, with split contents. I guess the answer is difficult, because not all applications move groups of files in the same way.

© Super User or respective owner

Related posts about Windows

Related posts about unix