On 03/06/2010 17:50, Bob Greschke wrote:
On 2010-06-03 09:57:11 -0600, Tim Golden <mail at timgolden.me.uk> said:
On 03/06/2010 16:39, Bob Greschke wrote:
How do I do a "listdir" (or whatever I need to use) of the Desktop on a
Windows machine and have "folders" like My Documents show up in the
I'm specifically trying to get a link to VMWare Shared Folders to show
up so I can navigate to files in OSX from WinXP running in VMWare, but
My Documents doesn't show up, either.
The docs for listdir says it doesn't follow links and I don't think I
want to tell os.walk to followlinks as that could be zillions of files.
Depends exactly what '"folders" like My Documents' means (since I'm
with VMWare Shared Folders) but you almost certainly want to use the
functions to walk the shell from the Desktop root. There was a short
recently about it which I'll try to dig up (digs...):http://mail.python.org/pipermail/python-win32/2010-May/010475.html
Well, My Documents is not a normal folder. It's not the same as
right-clicking and creating a new folder. I don't know what it is,
It's a shell folder. Which is what the code I pointed to deals with.
VMWare Shared Folders seems to be a normal sort of link to
'\\.host\Share Folders', but not quite, however, beyond that I'm not
sure what it is.
This would be the official starting point for reading up on the
matter if you were motivated enough:http://msdn.microsoft.com/en-us/library/bb773177%28VS.85%29.aspx
Basically, Windows has two "file systems" running in parallel
and mostly, but not always, overlapping: the normal NTFS file
system; and the Shell system. The NTFS file system starts from,
say, c:\ and goes down from there. The Shell starts from the
desktop and goes down from there. Obviously, under the covers,
all shell objects have to be stored in some way on the file
system. All NTFS files are represented within the Shell system;
not all Shell objects are straightforwardly represented within
the NTFS filesystem.
If I create Shortcuts to My Documents and VSF those
show up with listdir, but I cannot follow them; Python does not think
they are directories, which they aren't (they show up from listdir as
'Shortcut to My Documents.lnk', for example).
Now you're talking about something slightly different. Windows has
had Shortcuts since pretty much forever. They also are Shell objects
and the shortcut-ness is only interpreted by the Shell, not by the
filesystem. NTFS has had junctions and hardlinks since Win2K and now
has symbolic links (which are implemented, I think, on the top of
the uber-flexible Reparse Points) from Vista onwards. Both the Shell and
the filesystem will follow these. Indeed you have to go out of your
way *not* to follow them.
Hopefully that explanation has helped (where it hasn't confused!).
You might want to look at my winshell module (long overdue for
and at some of the articles on Mike Driscoll's Blog:http://www.blog.pythonlibrary.org/2010/02/25/creating-windows-shortcuts-with-python-part-ii/