Fix scan scripts to be fully configurable via environment variables.
Added checks to skip scanning of empty files.