made script treat directories properly
cleaned up the script and made it notice only files

This way you can use it easilly with parallel utility