Shell snippets
From Flavio's wiki
Moving all files to another directory structure
$ find -type f | while read f; do mv -f --backup=t "$f" "../otherdir/$f"; done
Removing empty directories
$ find -depth -type d | xargs rmdir
The trick here is that rmdir
will not remove non-empty directories.
We use find -depth
to act on deeper directories first.