[EMAIL PROTECTED] wrote: > Hello NG, > > in my application, I use os.walk() to walk on a BIG directory. I need > to retrieve the files, in each sub-directory, that are owned by a > particular user. Noting that I am on Windows (2000 or XP), this is what I > do: > > for root, dirs, files in os.walk(MyBIGDirectory): > > a = os.popen("dir /q /-c /a-d " + root).read().split() > > # Retrieve all files owners > user = a[18::20] > > # Retrieve all the last modification dates & hours > date = a[15::20] > hours = a[16::20] > > # Retrieve all the filenames > name = a[19::20] > > # Retrieve all the files sizes > size = a[17::20] > > # Loop throu all files owners to see if they belong > # to that particular owner (a string) > for util in user: > if util.find(owner) >= 0: > DO SOME PROCESSING > > Does anyone know if there is a faster way to do this job?
You may use "dir /s", which lists everything recursively. -- http://mail.python.org/mailman/listinfo/python-list