And it is well. I will show the result.
-rwx------ 1 user group 311521 May 29 07:33 1.jpg
-rwx------ 1 user group 311521 May 29 07:38 2.jpg
drwx------ 1 user group 0 Jun 03 16:13 test1
I can not read the date of file ' May 29 07:33'
should be '2010-05-29 07:33:00' how do this???
use FTPLISTEINFO below
liglisteFTP represent one line like '-rwx------ 1 user group 311521
May 29 07:33 1.jpg'
function AJUSTELIG(chainex:String;lgmax:integer;bourrage:Byte):String;
//retourne une chaine contenant exactement lgmax caractères
//si chainex est supérieure à lgmax, chainex est tronquée
//si chainex est inférieure on y rajoute les caractères de bourrage
//bourrage=0 ou >3 : espaces derrière
// 1 espaces devant
// 2 zéros derrière
// 3 zéros devant
var lgchaine, cptcar:integer;
chainetmp:string;
begin
If lgmax <= 0 Then chainex := '' else
begin
lgchaine := Length(chainex);
If lgchaine > lgmax Then
begin
chainetmp:='';
for cptcar:=1 to lgmax do chainetmp:=chainetmp+chainex[cptcar];
chainex:=chainetmp;
end
else
begin
If lgchaine < lgmax Then
begin
Case bourrage of
1:while length(chainex)<lgmax do chainex:=#32+chainex;
2:while length(chainex)<lgmax do chainex:=chainex+'0';
3:while length(chainex)<lgmax do chainex:='0'+chainex;
else while length(chainex)<lgmax do chainex:=chainex+#32;
End;
end;
end;
end;
result := chainex;
end;
function FTPLISTEINFO(NumChamp:byte;liglisteFTP:string):string;
//retourne le champ de liglisteFTP
//note1 : retourne '#' si NumChamp incorrect ou champ non trouvé
//note2 : si NumChamp=5 : retourne '#' si la ligne est un répertoire
//NumChamp=1 PRIV
// =2 IND
// =3 NOM1
// =4 NOM2
// =5 TAILLE
// =6 MOIS converti au format 01 à 12 : retourne toujours 2 chiffres
// =7 JOUR : retourne toujours 2 chiffres
// =8 HEUREMINUTE : retire le ':' et retourne toujours 4 chiffres
// =9 NOMFIC
var lgcar,cptcar,cptchamp:byte;
champx,champret,moisx,heux,minx :string;
fin,espace,heure:boolean;
moisl,jol,heul,minl:longint;
begin
champret:='#';
lgcar:=length(liglisteFTP);
if ((lgcar>0)and(numchamp=5)) then
begin
if liglisteftp[1]='d' then lgcar:=0;
end;
if ((lgcar>0)and (NumChamp>0)and(numchamp<=9)) then
begin
cptchamp:=1;
cptcar:=0;
champx:='';
fin:=false;
espace:=false;
repeat
inc(cptcar);
case liglisteFTP[cptcar] of
#32 :if cptchamp<9 then
begin
if espace=false then
begin
if cptchamp=NumChamp then fin:=true else
begin
cptchamp:=cptchamp+1;
champx:='';
end;
end;
espace:=true;
end
else
begin
//le nom peut comporter des espaces
champx:=champx+#32;
end;
else
begin
champx:=champx+liglisteFTP[cptcar];
espace:=false;
end;
end;
if cptcar>=lgcar then fin:=true;
until (fin);
if champx<>'' then
begin
if cptchamp=NumChamp then
begin
case numchamp of
6:begin
moisl:=0;
moisx:=MAJUS(champx);//passer en majuscules
if moisx='JAN' then moisl:=1
else if moisx='FEB' then moisl:=2
else if moisx='MAR' then moisl:=3
else if moisx='APR' then moisl:=4
else if moisx='MAY' then moisl:=5
else if moisx='JUN' then moisl:=6
else if moisx='JUL' then moisl:=7
else if moisx='AUG' then moisl:=8
else if moisx='SEP' then moisl:=9
else if moisx='OCT' then moisl:=10
else if moisx='NOV' then moisl:=11
else if moisx='DEC' then
moisl:=12;
if moisl<>0 then champret:=AJUSTELIG(N(moisl),2,3);
end;
7:begin
jol:=T(champx);
if ((jol>0) and (jol<=31)) then
champret:=AJUSTELIG(N(jol),2,3);
end;
8:begin
heux:='';
minx:='';
heure:=true;
for cptcar:=1 to length(champx) do
begin
if champx[cptcar]=':' then heure:=false
else
begin
if heure=true then heux:=heux+champx[cptcar]
else minx:=minx+champx[cptcar];
end;
end;
heul:=T(heux);
minl:=T(minx);
if ((heul>-1)and(heul<24)and (minl>-1)and(minl<60)) then
begin
champret:=AJUSTELIG(N(heul),2,3)+AJUSTELIG(N(minl),2,3)
end;
end;
else champret:=champx;
end;
end;
end;
end;
result:=champret;
end;
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be