Setting the archive bit / Tracking "processed" files

Setting the archive bit / Tracking "processed" files

Postby xProgrammer » Mon Mar 01, 2010 11:45 pm

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
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

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

Postby hua » Tue Mar 02, 2010 1:57 am

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.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

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

Postby xProgrammer » Tue Mar 02, 2010 6:07 am

Thanks Hua

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

Regards
(a slightly embarrassed) xProgrammer
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 90 guests