Jump to content

Read file Archive bit attribute


rkehn

Recommended Posts

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

Link to comment
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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.