Re: file system iteration

2006-10-09 Thread rick
Thanks Tim and Rob... this works really well! -- http://mail.python.org/mailman/listinfo/python-list

Re: file system iteration

2006-10-09 Thread Duncan Booth
rick <[EMAIL PROTECTED]> wrote: > Georg Brandl wrote: > >> Which application needs to walk over ALL files? Normally, you just >> have a starting path and walk over everything under it. > > Searching for a file by name. Scanning for viruses. Etc. There are > lots of legitimate reason to walk all

Re: file system iteration

2006-10-09 Thread Georg Brandl
Jonathan Hartley wrote: > Georg Brandl wrote: > >> Which application needs to walk over ALL files? > > How about 'updatedb' for starters, the index-maintainer for the common > *nix command-line utility 'locate'. > > I'm pretty sure that os.walk( ) deals with symbolic links (by not > visiting t

Re: file system iteration

2006-10-09 Thread Georg Brandl
rick wrote: > Georg Brandl wrote: > >> Which application needs to walk over ALL files? Normally, you just have a >> starting path and walk over everything under it. > > Searching for a file by name. Scanning for viruses. Etc. There are lots > of legitimate reason to walk all paths from a central

Re: file system iteration

2006-10-09 Thread Jonathan Hartley
Georg Brandl wrote: >> Which application needs to walk over ALL files? How about 'updatedb' for starters, the index-maintainer for the common *nix command-line utility 'locate'. I'm pretty sure that os.walk( ) deals with symbolic links (by not visiting them) and ' /proc' type complexities by

Re: file system iteration

2006-10-09 Thread rick
Tim Golden wrote: > [Rick] > | Searching for a file by name. Scanning for viruses. Etc. > | There are lots > | of legitimate reason to walk all paths from a central > | starting point, no??? > > Well, to get you started, I think this is the kind > of thing you'll want. Uses ctypes, which is bui

RE: file system iteration

2006-10-09 Thread Rob Williscroft
Tim Golden wrote in news:mailman.119.1160403292.11739.python- [EMAIL PROTECTED] in comp.lang.python: > [Rick] >| Searching for a file by name. Scanning for viruses. > Etc. >| There are lots >| of legitimate reason to walk all paths from a centra > l >| starting point, no??? > > Well, to get y

Re: file system iteration

2006-10-09 Thread rick
Fredrik Lundh wrote: > what's the difference between a "starting path" and a "starting point" ? None. What starting path or point would you suggest under Windows? Is there something obvious that I'm missing? I see no starting point under windows as my initial question clearly stated. -- http://

Re: file system iteration

2006-10-09 Thread Fredrik Lundh
"rick" <[EMAIL PROTECTED]> wrote: >> Which application needs to walk over ALL files? Normally, you just have a >> starting path and walk over everything under it. > > Searching for a file by name. Scanning for viruses. Etc. There are lots > of legitimate reason to walk all paths from a central sta

RE: file system iteration

2006-10-09 Thread Tim Golden
[Rick] | Searching for a file by name. Scanning for viruses. Etc. | There are lots | of legitimate reason to walk all paths from a central | starting point, no??? Well, to get you started, I think this is the kind of thing you'll want. Uses ctypes, which is built-in to Python 2.5 so presumably

Re: file system iteration

2006-10-09 Thread rick
Georg Brandl wrote: > Which application needs to walk over ALL files? Normally, you just have a > starting path and walk over everything under it. Searching for a file by name. Scanning for viruses. Etc. There are lots of legitimate reason to walk all paths from a central starting point, no??? -

RE: file system iteration

2006-10-09 Thread Tim Golden
[Georg Brandl] | rick wrote: | > In Windows, the file system is disjointed and there is now | real 'root' | > At least none that I can see. It looks more like this: | > | > | | | | | | | | > |_|_|_|_|_|_| | > A B C D E F G | > | > How do you guys handle this when working with scripts that | n

Re: file system iteration

2006-10-09 Thread Georg Brandl
rick wrote: > In Unix, the file system hierarchy is like a tree that has a base or > 'root' that exposes objects (files and folders) that can easily be > iterated over. > > > \ \ | / / > \ \ | / / >\ \|/ / > \ | / > \|/ > | > | > Root > > So, when I do os.chdi

Re: file system iteration

2006-10-09 Thread rick
Gerrit Holl wrote: > The very least you can try: > > import string > string.ascii_uppercase > > for c in string.ascii_uppercase: > if os.path.isdir('%s:/' % c): > ... > > etc. > But I suppose there should be a better way. Oh yes, I do that. I spelled out the example very explicitly

Re: file system iteration

2006-10-09 Thread Gerrit Holl
On 2006-10-09 14:45:35 +0200, rick wrote: > import os.path > > paths = [] > > if os.path.isdir('A:/'): > paths.append('A:/') > > if os.path.isdir('B:/'): > paths.append('B:/') > > ... > > That's a kludge, but it works OK. I'm sure WMI may have a function that > returns mounted volumes