LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing file properties/details programacly

Highlighted

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 12
(1,470 Views)
Highlighted

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 LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 12
(1,463 Views)
Highlighted

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 12
(1,446 Views)
Highlighted

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 12
(1,430 Views)
Highlighted

@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 12
(1,427 Views)
Highlighted

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

 

BS

0 Kudos
Message 6 of 12
(1,421 Views)
Highlighted

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 12
(1,417 Views)
Highlighted

Of course .NET will do this as well:

FileInfo.png

Message 8 of 12
(1,407 Views)
Highlighted

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 12
(1,326 Views)
Highlighted

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 12
(1,322 Views)