![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Дата создания файла и количество строк?
Я © (2008-05-07 13:47:00)Скажите пожалуйста как можно используюя FindFirst/FindNext узнать дату создания файла и количество строк в каждом файле.
Что есть:
Функция определяющая дату создания файла
function GetFileDateTime(FileName: string): TDateTime;
var
intFileAge: LongInt;
begin
intFileAge := FileAge(FileName);
if intFileAge = -1 then
Result := 0
else
Result := FileDateToDateTime(intFileAge)
end;
FileAttrs := FileAttrs + faSysFile;
Кусок кода
var
sr: TSearchRec;
FileAttrs: Integer;
a:TDateTime;
begin
FileAttrs := FileAttrs + faSysFile;
if FindFirst('путь до файлов', FileAttrs, sr) = 0 then
begin
repeat
a:=GetFileDateTime(sr.Name);// не работает пытаюсь взять дату создания файла
if (sr.Attr and FileAttrs) = sr.Attr then
begin
ListBox1.Items.Add(sr.Name + ' ' + DateToStr(a));
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
Reindeer Moss Eater (2008-05-07 13:50:00) [21]function FileAge(const FileName: string): Integer;
Call FileAge to obtain the OS timestamp of the file specified by FileName. The return value can be converted to a TDateTime object using the FileDateToDateTime function.
The return value is -1 if the file does not exist.