Python - code not processing all files in directory
<p>The code below is only processing one file in my 'textpath' directory. I am using "for .. in ..:" statement so it should process all the files in the directory. I'm a Python newbie so any help would really be appreciated!</p>

<pre><code>textpath = "C:\Users\SL\Documents\FF Project\scratchpad\Text"
newpath = "C:\Users\SL\Documents\FF Project\scratchpad\TextFiles"
text2breaks = os.listdir(textpath)

for text2break in text2breaks:
    file = os.path.join(textpath, text2break)
    textfile=open(file)
    textFileContent=textfile.read()
    textFileList = re.split("[0-9]{1,2} of [0-9]{1,4} DOCUMENTS", textFileContent)
    for item in sorted(set(textFileList)):
        listpos = textFileList.index(item)
        resultsfilename = os.path.join(newpath, text2break[:-4] + "_" + str(listpos) + ".txt" )
        resultsfile = open(resultsfilename, "w")
        resultsfile.writelines(item)
        resultsfile.close()
</code></pre>
