Mega Code Archive

 
Categories / Delphi / Forum
 

Neoturk - dosyaya ilişkin bilgi ver function

herkese merhaba, {archive by neoturk} {************** path+filename dosyasının özelliğini döndürür ************************} function dosyaozellik(netipistiyon:byte;xfilename:string):string; var x,x2:string;bulunan:Tsearchrec;attr:integer; begin dosyaozellik:=''; x2:=extractfilepath(xfilename); x:=extractfilename(xfilename); chdir(x2); case netipistiyon of 1://sadece ozelliklerini istiyom begin if findfirst(x,faanyfile,bulunan)=0 then begin x2:='('; attr:=filegetattr(x); if (attr and fasysfile)<>0 then x2:=x2+'S'; if (attr and fahidden)<>0 then x2:=x2+'H'; if (attr and faarchive)<>0 then x2:=x2+'A'; if (attr and fareadonly)<>0 then x2:=x2+'R'; x2:=x2+')'; dosyaozellik:=x2; end; end;//1 2://sadece buyukluğunu istiyom_normal buyukluk begin if findfirst(x,faanyfile,bulunan)=0 then begin dosyaozellik:=inttostr(bulunan.size); //byte cinsinden. end; end;//2 3://sadece buyukluğunu istiyom_formatlı buyukluk begin if findfirst(x,faanyfile,bulunan)=0 then begin dosyaozellik:=formatfloat('#,',bulunan.size); end; end;//3 4://sadece tarih ve saatini istiyom begin if findfirst(x,faanyfile,bulunan)=0 then begin dosyaozellik:=datetimetostr(FileDateToDateTime(bulunan.time)); end; end;//4 5://sadece tarih istiyom begin if findfirst(x,faanyfile,bulunan)=0 then begin dosyaozellik:=copy(datetimetostr(FileDateToDateTime(bulunan.time)),1,10); end; end;//5 6://sadece saat istiyom begin if findfirst(x,faanyfile,bulunan)=0 then begin dosyaozellik:=copy(datetimetostr(FileDateToDateTime(bulunan.time)),11,255); end; end;//6 end; //case end; kullanımı: var x:string; x:=dosyaozellik(1,'c:\programs\myprogram.exe'); // ASHR (arhive system hidden readonly vs... x:=dosyaozellik(2,'c:\programs\myprogram.exe'); // 3450000 x:=dosyaozellik(3,'c:\programs\myprogram.exe'); // 345.000 x:=dosyaozellik(4,'c:\programs\myprogram.exe'); // 13.05.2004 15:45:12 x:=dosyaozellik(5,'c:\programs\myprogram.exe'); // 13.05.2004 x:=dosyaozellik(6,'c:\programs\myprogram.exe'); // 15.45.12 saygılarımla_ xxnt03@lycos.co.uk neoturk_