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.037 c
1:22151
What a
2001-12-20 14:06
2002.01.08
MDI -ClientForm


1:22206
T2
2001-12-16 07:11
2002.01.08
Align field


1:22129
Aleksandr
2001-12-19 16:04
2002.01.08
How to remove the flicker of your scrollbar?


1:22069
Xtorm
2001-12-19 10:40
2002.01.08
How?


1:22043
Serge
2001-12-18 19:18
2002.01.08
Deleting an object





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 Spanish 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