#!/usr/bin/python # Do something with the files matchng a pattern, sorted by name # Example: globdo.py '*.txt' import glob, sys pattern= sys.argv[1] files= glob.glob(pattern) files.sort() print files for file in files: print file+ '\n'