finding mount points
John Clonts
jclonts at mastnet.net
Wed Jul 12 01:21:58 EDT 2000
Suchandra Thapa wrote:
>
> Is there any way to find the mount point of a filesystem given
> the path to a file within the file system? Using os.path.ismount
> lets you determine if a path is a mount point but is there any function
> that returns something like /mnt/cdrom if you give it a path like
> /mnt/cdrom/foo/bar.txt?
>
> --
> ------------------------------------------------------------------
>
> Suchandra S. Thapa
> s-thapa at uchicago.edu
>
> ------------------------------------------------------------------
Python 1.3 (Sep 10 1996) [GCC 2.7.2]
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import posixpath
>>> posixpath.ismount("/")
1
>>> posixpath.ismount("/mnt")
0
>>> posixpath.ismount("/mnt/dosd")
1
>>> posixpath.ismount("/home")
1
>>> posixpath.ismount("/home/john")
0
>>>
Is this what you wanted?
Cheers,
John
More information about the Python-list
mailing list