From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing file properties/details programacly

Solved!
Go to solution

I'm looking for a way to access the details of a file in LabView.  Specially I'm looking for the owner of a fil, date created and date modified.  Any help is appreciated.

Thanks

Mike

0 Kudos
Message 1 of 16
(5,289 Views)

Hi Mike,

 

open a (Windows) command shell and type "dir /?": it lists several options to display the owner or the creation date.

 

Now all you need is to use SysExec with such a "dir" command and parse the result…

Best regards,
GerdW


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

Here is one solution, if you want to install a toolkit. (Toolkit is free, BSD license)

 

Use the OpenG File Info VI, download the OpenG File Tools from VIPM.

 

mcduff

 

 

Message 3 of 16
(5,265 Views)

Wow.  I hadn't looked closely, but that's a really old function!  The comment I found for Creator was "For Mac only", for example ...  Still, OpenG does have things that I use quite a bit ...

 

Bob Schor

0 Kudos
Message 4 of 16
(5,249 Views)

@Bob_Schor wrote:

Wow.  I hadn't looked closely, but that's a really old function! 


An oldie but a goodie, still works, and gives the OP the info they want.

 

mcduff

0 Kudos
Message 5 of 16
(5,246 Views)

Unless he (or she) really does want the file creator (in Windows) ...

 

BS

0 Kudos
Message 6 of 16
(5,240 Views)

I'll leave it to rolfk to chime in with a more elegant and knowledgeable response, but type and creator were mac only, I believe. The original MacOS up till version X did not have, nor need file extensions, the metadata type and creator took care of that.  Below shows all of the information available from the VI.

 

Snap4.png

0 Kudos
Message 7 of 16
(5,236 Views)
Solution
Accepted by rolfk

Of course .NET will do this as well:

FileInfo.png

Message 8 of 16
(5,226 Views)

hi wiebe

I cannot import your snippet. (but it works with this one https://forums.ni.com/t5/LabVIEW/Simulation-is-not-running/m-p/3343124/highlight/true#M981978) why?

Can you please tell what .net constructor you used and maybe how you found the right one?

thanks.

0 Kudos
Message 9 of 16
(5,145 Views)

I'm not sure why that one works, and mine doesn't. I do know why mine doesn't Smiley Wink. Lithium probably still removes the VI section from the PNG when saving the image. If you get the URL of the image, open it in a new tab, and then use you're browser to save it, I think it works. Not sure, but trickery like that used to work. See this. The other snippet's date of posting might be the reason. Not sure...

 

I think downloading the image as attachment works as well. See attachment Smiley Wink.

 

Back to the topic... 

 

FileInfo is in mscorlib.dll, System.IO. So browse to mscorlib, and look in System.IO.

 

If you google "FileInfo .NET", and go to the MSDN, it will mention this. I'm not saying "google it" as a smart sneer, but it isn't that obvious. I'm trying to teach how to catch a fish, instead of catching the fish for you. Can't resist it:

 

FileInfo Class

Definition

 

Message 10 of 16
(5,141 Views)