Skipping empty directories

hostalp at post.cz hostalp at post.cz
Thu Jun 30 05:33:29 MDT 2011


Hello,

I'd like to skip empty directories from being transferred to the target location.
I'm well aware of --prune-empty-dirs option, however that switches from incremental to full file list mode which is undesired.
It would be really nice to have an option to omit empty dirs on the fly.

Say I've got a filter list, based on that some content is transferred to the target location. This includes lots of empty directories (they aren't empty at the source location but after applying rsync filter rules they end up as empty). And these are ones I would like to simply skip from being transferred.
I believe it should be possible to add an option to skip empty directories by altering how the directories are being examined in regard to the filter rules. Or maybe something like - an option to switch to ad-hoc directory creation mode when directories would be created at target location only when rsync reaches the point when it knows there's actually some file to be put in there.. etc etc

Would something like that be feasible?

Yes there are ways for how to generate a "pruned" list  via perl for example, but I hope it should be a bit more easy.

Petr



More information about the rsync mailing list