Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About FileDateToDateTime

Status
Not open for further replies.

piggy213

Programmer
Sep 27, 2002
19
0
0
TW
The following is done to fliter update file and copy the files to another directory.
But I have the problem.When it runs to the line 13, it show me the error message 'Invalid argument to date encode'!
Why? Anybody knows?
Thanks!
1. procedure TForm1.Button1Click(Sender: TObject);
2 var i: Integer;
3 dt: TDateTime;
4. ps: TDateTime;
5. S1, M: String;
6. sDir, s2Dir, tDir: String;
7 begin
8 sDir := DirectoryListBox1.Directory + '\';
9 tDir := DirectoryListBox2.Directory + '\';
10 for i := 0 to FileListBox1.Items.Count - 1 do
11 begin
12 S1 := FileListBox1.Items.Strings;
13 dt := FileDateToDateTime(FileAge(FileListBox1.Items));
14 if dt >= (Now - 1) then
15 begin
16 s2Dir := sDir + FileListBox1.Items;
17 tDir := DirectoryListBox2.Directory + FileListBox1.Items;
18 Windows.CopyFile(PChar(s2Dir),PChar(tDir),false);
19 end;
20 end;
21 end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top