Simple python script to list files in a directory.

print files names in a directory... easy but useful.

import os

dir = os.getcwd()


f = open( "_list.txt" , "w" )
count = 0
for item in os.listdir(dir):
        print item + "\n",
        f.writelines( item + "\n" ),
        count = count+1

f.writelines( "the number of documents is %d" % count ),
print "the number of documents is %d" % count ,
f.close()

Comments

Popular posts from this blog

Find countries in a file's text using regular expressions and Perl

Make links active in Excel 2007