Onyx logo

Previous topic

onyx.util.flatten – Flatten nested structures

Next topic

onyx.util.iterutils – The objects in this module provide operations on iterable objects.

This Page

onyx.util.filesystem – Filesystem utilities

onyx.util.filesystem.get_fs_typename(filename)

Returns a string, the name of the type of filesystem on which filename resides, e.g. 'ext3' or 'gpfs', or None if the name of the type of the filesystem cannot be determined.

Raises OSError if filename does not point to an accessible file or directory.

These are edge-cases tests because this function is hard to test in a platform/environment-independent way.

>>> t = get_fs_typename('/')
>>> (t is not None and len(t) > 0) == os.path.exists(_mounts_filename)
True
>>> get_fs_typename('/_no_such_file_')
Traceback (most recent call last):
  ...
OSError: [Errno 2] No such file or directory: '/_no_such_file_'