2016-03-17 09:00:37 -0600, Eric Blake: [...] > That said, if you WANT an error if 'two/' does not exist, and to move > 'one' to 'two/one' if 'two/' does exist, you can always use: > > mv one two/. > > where the trailing '.' changes the semantics required of the rename() > call, and forces an error if 'two/' does not exist. [...]
See also the GNU-specific mv -t two one To move one into two. For the reverse: force a move-to as opposed to a move-into, another GNU-specific option: mv -T one two if two is a directory, you'll get an error. If two is a symlink (to directory or other), one is renamed to two (and the symlink is gone). FreeBSD mv has: mv -h one two To do a move-to instead of move-into when "two" is a symlink to a directory. -- Stephane