LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I programmatically determine the file system?

Solved!
Go to solution

The subject says it all, but for those interested in the backstory:

 

My application interfaces with a high speed digitizer. Each triggered acquisition is written to disk. The application was developed many years ago considering FAT32 limitations, namely if all files were allowed to be written to the same directory there was high risk of hitting the limit on the maximum number of files in a directory, and so the application separated files a few layers down in subdirectories. Nowadays with NTFS this isn't a problem, however the old approach is still used, and users are complaining about the pain of copying files our of the subdirectory structure.

 

Knowing that some hard disks are still formatted in FAT32 to this day, I want to be able to programmatically determine what file system is being used by the storage I'm writing to. If NTFS I'll switch to a much simple subdirectory structure.

 

Thanks!

 

0 Kudos
Message 1 of 6
(2,811 Views)

Hi banksey,

 

one approach (which came first to my mind):
check.png

 

I'm sure you also can get that information using a (Power)Shell batch or DotNET…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,764 Views)

Thanks for the reply, GerdW.

 

I tried that an unfortunately, at least on our systems, I could only get that command to work when running command prompt as administrator, yet most computer users won't have administrator privileges so when they're running the application it won't work.

 

I'll trying searching for the alternative solutions you suggest.

0 Kudos
Message 3 of 6
(2,750 Views)
Solution
Accepted by topic author banksey255

You can use GetVolumeInformationA, as recommended here: how-to-know-a-certain-disks-formatis-fat32-or-ntfs.

 

GetVolumeInformation.png

 

This returns NTFS for my system...

 

Attached VI is in LV13.

Message 4 of 6
(2,737 Views)

Works for me too. Many thanks, wiebe@CARYA.

0 Kudos
Message 5 of 6
(2,731 Views)

You can try this VI. It uses the GetVolumeInformation Windows API and if you want to know more detailed specifics about the different returned parameters you can look for the documentation of GetVolumeInformationA on MSDN.

Rolf Kalbermatter
My Blog
Message 6 of 6
(2,726 Views)