How to find out if the "path" is in the FAT32 partition?

is there any library or function that tells me the type of section for a specific "path" in python?

or how can i do this with any other approach?

early!

+6
source share
2 answers

How to find the file system type in python also seems relevant.

Here is what I came up with:

import subprocess import os def is_filesys_fat32(path): try: subprocess.check_call(['df', '--type=fat32', path], stdout=os.devnull) except: return False return True 

Assuming you are using linux (as the tag is mentioned), and that you are only looking for a type of this type, you are not getting a type (use the regular expression on subprocess.check_output() using the same command?).

+3
source

Well, in my previous answer, I thought you needed windows, however, I believe I found a way on Linux.

Try the following:

Using the subprocess of this command df -T /users/f/foo/file.txt , you can get the desired results.

 import subprocess p = subprocess.Popen(["df -T %s"] % path, stdout=subprocess.PIPE) out, err = p.communicate() 

Output Example:

 Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda5 ext4 472439072 146088944 302351616 33% / 
+1
source

Source: https://habr.com/ru/post/944584/


All Articles