Clone a directory tree without files

Sometimes you need to clone a whole directory tree but leave make it empty. This is useful if you’re purging out old files and just need to start from scratch. This can be done with:

rsync -vaA –progress -f”+ */” -f”- *” source/ destination/

I like the –progress flag so that I can see what it’s copying and the -A flag keeps ACLs, which can be important in shared environments.… Read the rest