analyzing removable media
glenn
glenn at tangelosoftware.net
Fri Sep 29 02:23:23 EDT 2006
Hi Jay
pls excuse top post - Im actually doing this project in linux, but am
wanting it to be cross platform. I definitley have to cater for win32
also. I was hoping that burried in sys or os or that there'd be some x
platform module that did all that stuff for me
thnks for reply though
glenn
Jay wrote:
> Well, in linux you can get a lot of info about where a file is based
> upon where it lies in the file system. For example, if the folder the
> file is located in resides in the /media or /mnt directories, then the
> file is, barring a few rare circumstances, located upon a removable
> medium of some sort. Once you get the name of that directory that is
> right below /media or /mnt, then you can cross check the name in
> /etc/fstab file.
>
> However, the contents of your post lead me to believe that you're
> working in a win32 environment. That's a bit trickier. Things aren't
> so simple. You could probably grab similar information from the full
> path itself. For example, just getting the drive letter that the file
> resides on could tell you a lot. Now, where you'd cross check that is
> more of a mystery to me. I'd guess the registry? For an easier way of
> accessing the registry, I believe that the wrapper pywin32 may be of
> interest to you. It shouldn't be that hard considering that you'd only
> be getting some information, not setting anything.
>
> If by chance we're talking about MacOS, I'm of almost no help. In the
> case of MacOS X, it has a unix core, so I'd imagine that the method I
> described for linux could probably be adapted.
>
> Jay
>
> glenn wrote:
> > Hi
> > can anyone tell me how given a directory or file path, I can
> > pythonically tell if that item is on 'removable media', or sometype of
> > vfs, the label of the media (or volume) and perhaps any other details
> > about the media itself?
> > thanks
> > Glenn
More information about the Python-list
mailing list