Next / Previous / Contents / Shipman's homepage

8.2. oldfiles.py: The main program

Again, this section is pretty much identical to the main program of bigfiles.py.

oldfiles.py
# - - - - -   m a i n   - - - - -

def main():
    """Main program."""

    print "=== %s %s ===" % (SCRIPT_NAME, EXTERNAL_VERSION)

    #-- 1 --
    # [ if sys.argv[1:] is empty ->
    #     dirList  :=  [ "." ]
    #   else ->
    #     dirList  :=  sys.argv[1:] ]
    dirList  =  sys.argv[1:]
    if  len(dirList) == 0:
        dirList  =  [ "." ]

    #-- 2 --
    # [ sys.stdout  +:=  reports listing files below each
    #       directory named in dirList, with files in reverse
    #       chronological order by modification time ]
    for  dirName in dirList:
        #-- 2 body --
        # [ dirName is a string ->
        #     sys.stdout  +:=  a report listing the files below
        #         directory (dirName), with files in reverse
        #       chronological order by modification time ]
        report ( dirName )