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.034 c
1-22109
avr555
2001-12-19 17:17
2002.01.08
Combobox in Grid


3-21985
Scully
2001-12-06 15:26
2002.01.08
Date + time without seconds in DBGrid


1-22256
walking questionnaire
2001-12-15 08:50
2002.01.08
Reading values ​​from ini file


3-21941
jin
2001-11-30 14:56
2002.01.08
Help please create an IB SQL procedure from the application


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





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