开发者

How to find the file system type in python

开发者 https://www.devze.com 2022-12-29 14:04 出处:网络
I\'m looking for a way in python 开发者_如何学编程to find out which type of file system is being used for a given path. I\'m wanting to do this in a cross platform way. On linux I could just grab the

I'm looking for a way in python 开发者_如何学编程to find out which type of file system is being used for a given path. I'm wanting to do this in a cross platform way. On linux I could just grab the output of df -T but that won't work on OSX or windows.


Take the hint -- different platforms are actually different.

Use lsvfs on Mac OS X and those Linux that support it.

Use this on Windows.

Use an if-statement to decide.


This is the Windows API you might want to call. This should be a good start for the OS X api you are looking for, instead.


os.popen('/sbin/fdisk -l /dev/sda') on Linux

0

精彩评论

暂无评论...
验证码 换一张
取 消