Be careful, I had made a big mistake here. 'mktemp -d' creates a directory in /tmp, and, surely, it is another file system. So 'mv' will just 'cp'. So ${tempdirname} should be in the some file system as <dir> Regards, Pablo. El 12/06/2013 08:16 p.m., Liam Slusser escribi?: > So combining the two approaches I think that this may be a better > solution? > > tempdirname=`mktemp -d` > mv <dir> $tempdirname > mkdir <dir> > > # rm -rf <tempdirname> > mkdir empty > rsync -a --delete empty/ $tempdirname > rmdir empty $tempdirname > > > > Regards, > Pablo.