new version of scan dir script