: Very simple once I stopped to actually think about it.
:
:
: import os
:
: highestnumbers = {}
: highestfiles = {}
:
: for filename in os.listdir("C:\\TEMP\\py"):
: basename, extension = filename.split('.')
: prefix, number = basename.split(' - ')
: if number > highestnumbers.get(prefix, 0):
: highestnumbers[prefix] = number
: highestfiles[prefix] = filename
:
: prefixes = highestfiles.keys()
: prefixes.sort()
: for prefix in prefixes:
: print 'Latest file for %s prefix is: %s' % (prefix, highestfiles[prefix])
:
:
: This, of course, depends on consistently applied naming conventions. If the file names change patterns at all then it won't work. Should get you started, though.
:
:
:
infidel
:
:
it works great! thanks a lot!