🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #132

Re: How to know if files was changed

#132
From: Pieter Zijlstra
Date: Tue, 20 Jan 2004 20:14
30 lines
1897 bytes
Bruno Lovatti wrote...

> i need to send files through a tcp or ftp connection, no problem.
> but i have a lot of files in the source folder, so i'd like to send
> only the files changed since the last send.
> i know how to this using the date+time of the file and keeping a
> database to compare the dates the next time.
> but i think it's possible by removing the archive bit from the file
> and checking it in the next time. is it possible?

You can use FindFirst and FindNext and check for faArchive.
After copy/transfer you can clear the archive bit by using...

function ClearArchiveAttrib(const Filename: string): Integer;
var
  Attributes: Word;
begin
  Attributes := FileGetAttr(Filename);
  Result := FileSetAttr(Filename, (Attributes and not faArchive));
end;

> is it secure? windows or another program will always set this archive
> bit when change the file?

AFAIK this is _always_ done by the OS.
This will not work of course if you're using other software which
is also using/resetting the archive bits like (most?) backup software.

-- 
Pieter
Technical Details
Message-ID: <400d8be9@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <400d4c35$3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f94dd,a5a9c9fc3a1e4771
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2004-01-20 12:32:22 PST
From: "Pieter Zijlstra" <pzijlstra02@freeler.nl>
Subject: Re: How to know if files was changed
Newsgroups: borland.public.delphi.nativeapi
References:  <400d4c35$3@newsgroups.borland.com>
User-Agent: XanaNews/1.15.8.5
Date: Tue, 20 Jan 2004 21:14:53 +0100
NNTP-Posting-Host: 62.21.163.135
Message-ID: <400d8be9@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1074629609 62.21.163.135 (20 Jan 2004 12:13:29 -0700)
Lines: 30
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail