How to use rsync command to copy directory structure without copying files

Add “filter rules” in rsync command to include only directories and exclude files. An example is shown below:

rsync -av -f"+ */" -f"- *" dir-a/ dir-b

Consult man pages of rsync to get details on “filter rules”.

Leave a Reply