use main() instead of using globals
sorting by size by sqlie query
use os.listdir() instead of glob