Setting the archive bit / Tracking "processed" files

Post Reply
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Setting the archive bit / Tracking "processed" files

Post by xProgrammer »

Hi all

I need to write an application that checks for any "new" files in a directory and then processes them. One possibility is to use the date and time stamp of the file and keep a record of when the scan for new files was last done.

I was thinking that a better way might be to use the archive bit - as files are processed set the archive bit. I can get the archive bit OK with FileAttr(), and Directory() but how about setting the archive bit?

If I can set the archive bit then maybe I should try to modify Directory() to take an additional attribute for returning only files without the archive bit set to achieve what I want.

Regards
xProgrammer
hua
Posts: 861
Joined: Fri Oct 28, 2005 2:27 am

Re: Setting the archive bit / Tracking "processed" files

Post by hua »

Hi Doug,
>I can get the archive bit OK with FileAttr(), and Directory() but how about setting the archive bit?

Maybe SetFAttr()? It's in ct.lib in xHarbour.
SetFAttr()
Sets file attributes.

Syntax
SetFAttr( <cFileName>, [<nAttributes>] ) --> nErrorCode

Arguments
<cFileName>
This is a character string holding the name of the file to set attributes for. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory only.

<nAttributes>
This is a numeric value specifying the file attributes to set. Values of the following list are used for file attributes. To specifiy multiple attributes, pass the sum of the corresponding values:
Values for file attributes
  • 0 - Normal
    1 - Read only
    2 - Hidden
    4 - System
    8 - Volume
    32 - Archived
Return
The function returns zero on success or a numeric error code on failure.
FWH 11.08/FWH 19.03
xHarbour 1.2.1 (Rev 6406) + BCC
Harbour 3.1 (Rev 17062) + BCC
Harbour 3.2.0dev (r1904111533) + BCC
User avatar
xProgrammer
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Re: Setting the archive bit / Tracking "processed" files

Post by xProgrammer »

Thanks Hua

Somehow I didn't see SetFAttr() despite looking.

Regards
(a slightly embarrassed) xProgrammer
Post Reply