rkehn Posted December 18, 2005 Report Share Posted December 18, 2005 I'm trying to write a function that returns the files in a folder that have the Archive bit set. :headbang: Is there a way in labview to read this information? The get file info VI seems to be very limited (probably do to portability). I trying to avoid having to compare file modified date to a history file. Seem like a lot of work when the OS already does this book keeping for me! Thanks Quote Link to comment
Rolf Kalbermatter Posted December 18, 2005 Report Share Posted December 18, 2005 I'm trying to write a function that returns the files in a folder that have the Archive bit set. :headbang: Is there a way in labview to read this information? The get file info VI seems to be very limited (probably do to portability). I trying to avoid having to compare file modified date to a history file. Seem like a lot of work when the OS already does this book keeping for me!Thanks You will have to call a Windows API function. Use the Call Library Node and configure it so that the library name is kernel32.dll, function name GetFileAttributesA, calling convention stdcall, return value numeric, unsigned 32bit integer, and one function parameter filenname of type string, C pointer. Now wire in the filename path to the parameter input after having it converted to a string with the Path To String primitive and the return value from that function contains a whole bunch of information encoded in the individual bits. Basically if the return value is 0xFFFFFFFF then there was an error such as the file was not present. Otherwise you can AND the return value with following values and if the result is not 0 the bit is set: #define FILE_ATTRIBUTE_READONLY 0x00000001 #define FILE_ATTRIBUTE_HIDDEN 0x00000002 #define FILE_ATTRIBUTE_SYSTEM 0x00000004 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 #define FILE_ATTRIBUTE_ENCRYPTED 0x00000040 #define FILE_ATTRIBUTE_NORMAL 0x00000080 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800 #define FILE_ATTRIBUTE_OFFLINE 0x00001000 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 Some of them are redundant since LabVIEW returns them also in the File Info primitive. Enjoy Rolf Kalbermatter Quote Link to comment
rkehn Posted December 18, 2005 Author Report Share Posted December 18, 2005 Thanks for the great response. I have always avoided the Call Library Function because I could never get all the settings right. You made it very clear and strait forward. Thanks for not just saying Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.