os.listdir

Hari pulapaka at ligo.caltech.edu
Mon Sep 8 18:41:58 EDT 2003


Hi,

I have question regarding os.listdir()


I wanted to know if this is a reliable way to check for files added to
a directory??

files = os.lisdir(path)

currentlen = len(files)

// directory modified 

files = os.listdor(path)

newlen = len(files)

then the files in the range (currentlen -1) to (newlen -1) are all the
files added to the directory.

What I wanted to know was, is it guaranteed that between 2 calls
os.listdir any files added to the directory are appended and the
earlier order is maintained?

thanks,

Hari




More information about the Python-list mailing list