Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Down

Deleting directory contents Find similar branches


Марина   (2001-12-20 15:42) [0]

Can you please tell me how to delete the contents of the directory, and leave the directory itself? You need something like deletefile ("c: \ kio \ massiv \ *. *") Thankful in advance and I apologize for the "teapot" question.



gek   (2001-12-20 15:47) [1]

if Findfirst ("\ TEMP \ *. tmp", faAnyFile, SearchRec) = 0 then
while (FindNext (SearchRec) = 0) do
if not deletefile (pchar ("\ TEMP \" + SearchRec.name)) then
Application.Terminate;
FindClose (SearchRec);



Dimka Maslov   (2001-12-20 16:05) [2]

uses Windows, SysUtils, Classes, Masks; procedure DeleteFiles (Path: string); var Mask: string; SearchRec: TSearchRec; FindResult: Integer; List: TStringList; i: Integer; begin Mask: = ExtractFileName (Path); if Mask = "" then Mask: = "*. *"; Path: = ExtractFilePath (Path); if Path = "" then Path: = IncludeTrailingBackslash (GetCurrentDir); List: = TStringList.Create; try FindResult: = FindFirst (Path + "*. *", FaAnyFile, SearchRec); try while FindResult = 0 do with SearchRec do begin if ((Attr and faDirectory) = 0) and MatchesMask (Name, Mask) then List.Add (Name); FindResult: = FindNext (SearchRec); end; for i: = 0 to List.Count - 1 do DeleteFile (Path + List [i]); finally FindClose (SearchRec); end; finally List.Free; end; end;



Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];

Top









Memory: 0.55 MB
Time: 0.023 c
1-22164
Warchild
2001-12-19 21:46
2002.01.08
ListBox -> Row Select


1-22193
T2
2001-12-14 03:17
2002.01.08
DLL


1-22072
Garik
2001-12-19 11:08
2002.01.08
How to create a TFrame child instance dynamically


3-21982
Dush
2001-12-06 12:37
2002.01.08
Client connection to the database


6-22312
Leviathan
2001-10-15 00:24
2002.01.08
Hey, who knows about Indy? Help is needed!





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Español swahili Swedish thai turkish Ukrainian urdu vietnamese welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish