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.

 

Source:
http://psung.blogspot.com/2008/05/copying-directory-trees-with-rsync.html

Posted in Knowledge and tagged , , .

Leave a Reply

Your email address will not be published. Required fields are marked *