timdisney
timdisney

Reputation: 5337

How to find the file system type in python

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.

Upvotes: 6

Views: 2434

Answers (3)

S.Lott
S.Lott

Reputation: 391818

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.

Upvotes: 1

Felix
Felix

Reputation: 3134

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

Upvotes: -2

Related Questions