Adds scan routine to scan directories for files