Støv, fibre og metalliske partikler kan påvirke både uptime, levetid og driftssikkerhed. Derfor arbejder flere datacentre systematisk med contamination control.
procedure TForm1.ScanFiles( const aPath : String; Subs : Boolean; const L : TStrings ); VAR S : TSearchRec; CPath : String; begin ChDir(aPath); GetDir(0,CPath);
if FindFirst(IncludeTrailingBackslash(CPath)+\'*.*\',faANYFILE,S) = 0 then repeat if ( S.Attr and faSysFile = 0 ) and ( S.Attr and faDIRECTORY = 0 ) and ( S.Attr and faVolumeID = 0 ) and ( S.Name[1] <> \'.\' ) and ( S.Name[1] <> \'..\' ) then begin // Do the stoff here if OkToAdd(IncludeTrailingBackslash(CPath)+S.FindData.cFileName) then L.Add(IncludeTrailingBackslash(CPath)+S.FindData.cFileName); end; until FindNext(S) <> 0; FindClose(S);
if Subs and ( FindFirst(\'*.*\',faDIRECTORY,S) = 0 ) then repeat if ( S.Attr and faDIRECTORY <> 0 ) and ( S.Name[1] <> \'.\' ) and ( S.Name[1] <> \'..\' ) then begin ScanFiles(IncludeTrailingBackslash(CPath)+S.Name,Subs,L); ChDir(\'..\'); end; until FindNext(S) <> 0; FindClose(S); end;
procedure TForm1.ScanFiles( const aPath,aMask : String; Subs : Boolean ); VAR S : TSearchRec; CPath : String; hFile, size: integer; begin ChDir(aPath); GetDir(0,CPath);
if FindFirst(IncludeTrailingBackslash(CPath)+aMask,faANYFILE,S) = 0 then repeat if ( S.Attr and faSysFile = 0 ) and ( S.Attr and faDIRECTORY = 0 ) and ( S.Attr and faVolumeID = 0 ) and ( S.Name[1] <> \'.\' ) and ( S.Name[1] <> \'..\' ) then begin Label5.Caption := IntToStr(TCount); Label6.Caption := IntToStr(DCount); Inc(TCount); Form1.Refresh; end; until FindNext(S) <> 0; FindClose(S);
if Subs and ( FindFirst(\'*.*\',faDIRECTORY,S) = 0 ) then repeat if ( S.Attr and faDIRECTORY <> 0 ) and ( S.Name[1] <> \'.\' ) and ( S.Name[1] <> \'..\' ) then begin ScanFiles(IncludeTrailingBackslash(CPath)+S.Name,aMask,Subs); Inc(DCount); Form1.Refresh; ChDir(\'..\'); end; until FindNext(S) <> 0; FindClose(S); end;
procedure TForm1.Button1Click(Sender: TObject); begin ScanFiles(\'c:\\\',\'*.*\',TRUE); end;
Undskyld Martin. Jeg ville have give dig nogle point.... Kom tal at acceptere ZIRON\'s uden at give jer begge..... En anden gang.... Men tak for hjælpen
Jb >> Jeg bliver jo nødt til at protestere, det er altså at skyde gråspurge med kanoner, og lave en ny ståd hvergang man skal foretage sig noget.
Min rutine scaner ca. 20000 filer på 1 min. så det er altså ikke noget med at maskinen hænger i flere timer.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.