1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115:
| Procedure TBuchMain.FindFiles(aPath, aFindMask: String; aWithSub: Boolean); Var FindRec : tSearchRec; uvname, start, ziel : string; n, erg : integer; gefunden, raus : boolean; Begin raus := false; Dateiliste := TStringList.Create; If (aPath = '') or (aFindMask = '') then Exit; If aPath[Length(aPath)] <> '\' Then aPath := aPath + '\'; If FindFirst (aPath + aFindMask, faAnyFile - faDirectory, FindRec) = 0 Then Begin Repeat If (FindRec.Name <> '.') and (FindRec.Name <> '..') Then begin if aktuser <> 'an s' then begin if (pos('home.', FindRec.Name) > 0) or (pos('.pas', FindRec.Name) > 0) or (pos('.dfm', FindRec.Name) > 0) or (pos('.res', FindRec.Name) > 0) or (pos('.exe', FindRec.Name) > 0) or (pos('.dpr', FindRec.Name) > 0) OR (pos('.ddp', FindRec.Name) > 0) or (pos('.dof', FindRec.Name) > 0) or (pos('.dsk', FindRec.Name) > 0) or (pos('.dcu', FindRec.Name) > 0) or (pos('.cfg', FindRec.Name) > 0) then begin end end else begin if (pos('.ddp', FindRec.Name) > 0) or (pos('.dof', FindRec.Name) > 0) or (pos('.dsk', FindRec.Name) > 0) or (pos('.dcu', FindRec.Name) > 0) or (pos('.cfg', FindRec.Name) > 0) then begin end;
if (FindRec.Name[1] = '_') or (pos('.~', FindRec.Name) > 0) or (pos('bestand_', FindRec.Name) > 0) or (pos('temp_', FindRec.Name) > 0) or (pos('Geburtstag_', FindRec.Name) > 0) then begin showmessage(apath + findrec.name + ' wird gelöscht'); DeleteFile(apath + FindRec.name) end;
uvname := ''; for n := pos('Buecherei\', aPath)+10 to length(aPath) do uvname := uvname + apath[n]; if aPath[1] = label38.Caption[1] then begin start := label38.Caption; ziel := label30.Caption; home_filename := label38.Caption + uvname + FindRec.Name; work_filename := label30.caption + uvname + FindRec.name; end else begin start := label30.Caption; ziel := label38.caption; home_filename := label30.caption + uvname + FindRec.name; work_filename := label38.Caption + uvname + FindRec.name; end; if (fileexists(home_filename)) and (fileexists(work_filename)) then begin
if (FileDateToDateTime(FileAge(work_filename)) <> FileDateToDateTime(FileAge(home_filename))) and (fileage(work_filename) + 3600 <> FileAge(home_filename)) and (fileage(work_filename) <> FileAge(home_filename) + 3600) then begin erg := xmessagedlg('ArchivBit wurde gesetzt' +#13 + 'Soll ' + work_filename + ' '+#13+ datetimetostr(filedatetodatetime(FileAge(work_filename))) +#13+ 'durch ' + home_filename + ' '+#13+ datetimetostr(filedatetodatetime(FileAge(home_filename))) +#13+ ' ersetzt werden?', mtConfirmation, [mbYes, mbno, mbcancel], ['ja', 'nein', 'Abbrechen'], self.font); case erg of mryes : CopyFile(PChar(home_filename), PChar(work_filename), FALSE); mrcancel : raus := true; end; end end else if (fileexists(home_filename)) and (not fileexists(work_filename)) then begin if not directoryexists(ziel+uvname) then CreateDir(ziel+uvname); CopyFile(PChar(home_filename), PChar(work_filename), TRUE); end; end end; if raus = true then BREAK; Until FindNext(FindRec) <> 0; FindClose(FindRec); end;
If (Not aWithSub) or raus Then Exit; gefunden := FindFirst(aPath + '*.*', faAnyFile, FindRec) = 0; while gefunden do begin if ((FindRec.Attr and faDirectory) <> 0) and (FindRec.Name[1] <> '.') then FindFiles(aPath + FindRec.Name, aFindMask, aWithSub); gefunden := FindNext(FindRec) = 0; end; FindClose(FindRec);
End; |