6

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.

badp
  • 11,409
  • 3
  • 61
  • 89
timdisney
  • 5,287
  • 9
  • 35
  • 31

3 Answers3

1

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.

S.Lott
  • 384,516
  • 81
  • 508
  • 779
-2

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

Felix
  • 3,058
  • 6
  • 43
  • 53