开发者

Determine if a file 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜