added option for ignoring directories