On 03/17/2016 08:49 AM, Eric Blake wrote: >> Repeat-By: >> rmdir two 2> /dev/null >> mkdir one >> mv one two/ > > POSIX requires this to succeed, and renames 'one/' to 'two/'.
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. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature