Autor Beitrag
del1312
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190



BeitragVerfasst: Fr 01.12.06 10:35 
ich hab nen kleines tool womit ich ordner von lästigen dateien befreien kann, nun hätte ich aber gern so ne art log-funktion wo vorher jede datei die gelöscht wurde in einer datei geloggt wird, wie kann ich das machen?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 01.12.06 12:15 
Moin!

- Stringliste anlegen,
- vor dem Löschen die Datei+Pfad in die Stringliste,
- am Ende die Stringliste mit .SaveToFile() speichern.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 01.12.06 12:21 
user profile iconNarses hat folgendes geschrieben:
- am Ende die Stringliste mit .SaveToFile() speichern.


Dabei aber nicht die alte Datei überschreiben, sondern die daten anhängen, sonst bringt das Log nicht viel. ;)

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Fr 01.12.06 12:25 
user profile iconfreak4fun hat folgendes geschrieben:
Dabei aber nicht die alte Datei überschreiben, sondern die daten anhängen, sonst bringt das Log nicht viel. ;)


Was im Klartext heißt : LoadFromFile, Items.Add, SaveToFile. 8)

_________________
Gruß
Hansa
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 01.12.06 12:35 
Moin!

1. Hat er nix von einer(!) fortlaufenden Logdatei gesagt.
2. Als Dateiname DateTimeToStr(Now) nehmen... ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
del1312 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190



BeitragVerfasst: Fr 01.12.06 12:54 
puh wie genau mach ich das mit der stringliste anlegen? könntet ihr mir da bitte helfen?
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 01.12.06 12:56 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
var sl: TStringlist;
begin

sl := TStringlist.Create;
sl.LoadFromFile('logdatei.txr');
sl.Add('blubb');
sl.SaveToFile('logdatei.txt');
FreeAndNil(sl);

So in etwa :p

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
del1312 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190



BeitragVerfasst: Fr 01.12.06 13:11 
hm also damit wird jetzt die liste erstellt wo die dateinamen + pfad reinkommen und gespeichert aber wie kann ich
die dateinamen und pfad überhaupt an die liste übergeben? momentan hab ich das hier drin:
ausblenden Delphi-Quelltext
1:
DeleteFile((GetSpecialFolder(CSIDL_PROFILE))+ version +'\CATTemp\*.*');					


Heiß er ballert alles unter dem Verzeichnis weg, wie greift er dann aber vorher noch die Namen raus?
Dankeschön schonmal ;o)

Moderiert von user profile iconChristian S.: Quote- durch Delphi-Tags ersetzt
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 01.12.06 13:19 
Du löscht also das ganze Verzeichnis und nicht die Dateien einzeln? Mit FindFirst und FindNext kannst du Dateien auslesen.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
del1312 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190



BeitragVerfasst: Fr 01.12.06 13:31 
äh na nee das verzeichnis selber nicht nur halt als *.*
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Fr 01.12.06 13:37 
Dann hole dir doch alle Files aus dem Verzeichnis und fege jede einzeln weg. Dann hast du die Dateinamen auch ohne Probleme.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Fr 01.12.06 17:05 
user profile iconNarses hat folgendes geschrieben:
1. Hat er nix von einer(!) fortlaufenden Logdatei gesagt.


Ja, direkt nicht, aber dann kann er sie auch gleich jedesmal überschreiben und fertig. :lol:

_________________
Gruß
Hansa