Update index.js

Fixed: doesn't work properly if any auto-created files like .DS_Store presented inside folder