Modify python script to run on every file in a directory
<p>so I have a python script which takes the filename as a command argument and processes that file. However, because I have 263 files which need the same processing, I was wondering whether the command argument section could be modified with a for loop to consecutively run through all the files in a folder? Cheers, Sat</p>

<p>EDIT:</p>

<p>The code for the system argument is here:</p>

<pre><code>try:
    opt_list, args = getopt.getopt(sys.argv[1:], 'r:vo:A:Cp:U:eM:')

except getopt.GetoptError, msg:
    print 'prepare_receptor4.py: %s' %msg
    usage()
    sys.exit(2)
</code></pre>

<p>with 'r' being the name of the file needing to be processed and the others are optional arguments. I'm not sure how to modify this with a for loop.</p>
