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.022 c
1-22085
ProfiUgl
2001-12-19 15:24
2002.01.08
How to read command line options


3-21900
vano
2001-12-07 11:13
2002.01.08
TString and String


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


3-21977
Amelin Vadim
2001-12-03 20:42
2002.01.08
Creating a database in InterBase


1-22208
Nikos77
2001-12-15 18:34
2002.01.08
Tell me how to do the formatting





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