papyvore
Messages postés223Date d'inscriptionsamedi 15 novembre 2003StatutMembreDernière intervention16 décembre 2021
-
28 janv. 2018 à 17:37
papyvore
Messages postés223Date d'inscriptionsamedi 15 novembre 2003StatutMembreDernière intervention16 décembre 2021
-
29 janv. 2018 à 10:56
Bonjour,
Function FileCount(Chemin: String): Integer; Var S: TSearchRec; Begin Chemin := IncludeTrailingPathDelimiter(Chemin); Result := 0; If FindFirst(Chemin + '*.jpg', faAnyFile, S) = 0 Then Begin Repeat If (S.Name <> '.') And (S.Name <> '..') Then Begin If (S.Attr And faDirectory) <> 0 Then Result := Result + FileCount(Chemin + S.FindData.cFileName) Else Inc(Result); End; // Recherche du suivant Until FindNext(S) <> 0; FindClose(S); End; End;
la fonction sort de la boucle au premier dossier et ,ne prend pas en compte les sous dossiers ??
je ne comprend pas mon erreur .
d'autant que je retrouve la même fonction sur le net
ça marche pas sous windows 10 ????
Function FileCount(Chemin, AFileExt: String; AIgnoreCase: Boolean = False): Integer;
Var
S: TSearchRec;
Begin
Chemin := IncludeTrailingPathDelimiter(Chemin);
Result := 0;
If FindFirst(Chemin + '*.*', faAnyFile, S) = 0 Then
Begin
Repeat
If (S.Name <> '.') And (S.Name <> '..') Then
Begin
If (S.Attr And faDirectory) <> 0 Then
Result := Result + FileCount(Chemin + S.FindData.cFileName, AFileExt)
Else
If AIgnoreCase Then
Begin
If UpperCase(ExtractFileExt(S.Name)) = UpperCase('.' + AFileExt) Then
Inc(Result);
End
Else
If ExtractFileExt(S.Name) = '.' + AFileExt Then
Inc(Result);
End;
// Recherche du suivant
Until FindNext(S) <> 0;
FindClose(S);
End;
End;
@+
papyvore
Messages postés223Date d'inscriptionsamedi 15 novembre 2003StatutMembreDernière intervention16 décembre 202115 29 janv. 2018 à 10:56
29 janv. 2018 à 10:56