Get the filesystem type for a file

Hi, I’m making a small utility for macOS, and it would be nice if I could get the filesystem type (APFS, HFS+, DOS, etc.) for a file.

Thank you.

hi @ruicarneiro,
Have you tried to use ‘diskutil list’ it is a terminal (shell) command that lists out information, you can further use grep to filter what you want.

diskutil info -all or diskutil list

Cheers,

… and for more file/folder related code you can refer to this article

https://www.raywenderlich.com/157986/filemanager-class-tutorial-macos-getting-started-file-system

Thanks, but that won’t do, it will stop working as soon Apple changes the printing format. It really has to be an API.

Hi @ruicarneiro,
I understand your point, however even API’s can break with newer version as Apple changes the API or access to it. If I do come across a specific answer to your query, I will post it here.

cheers,

Jayant

This topic was automatically closed after 166 days. New replies are no longer allowed.