开发者

Determine if a file is on an NTFS filesystem

开发者 https://www.devze.com 2023-03-23 01:50 出处:网络
Is there a Windows API for开发者_运维知识库 determining if a certain file (path) is on an NTFS filesystem?

Is there a Windows API for开发者_运维知识库 determining if a certain file (path) is on an NTFS filesystem?

If this can be somehow inferred from an existing Python API, all the better.


Dont know how to do it in Python, but I assume that invoking C functions will be easy.

So in C open file handle bu CreateFile, you'll retrieve a handle to such file. Then call GetVolumeInformationByHandleW and check the lpFileSystemNameBuffer variable for "ntfs" string.


In python you can do:

import win32api
t = win32api.GetVolumeInformation(path)
print t[-1]

which will print ntfs if the path is on that filesystem type

(based on Yakeen's answer but also untested as i don't have a windows machine)


depending on your needs, you can use GetFileAttributes and check ntfs File Attribute Constants.

0

精彩评论

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