unit Unit_filerecovery;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.Menus,
Vcl.ExtCtrls, FileCtrl ;
type
TFileReCovForm =
class(TForm)
Memo1: TMemo;
MainMenu: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
Panel1: TPanel;
RootFolderEdit: TEdit;
SelectRFButton: TButton;
GetAllFoldersButton: TButton;
Label1: TLabel;
procedure GetAllFoldersButtonClick(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure SelectRFButtonClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
FOutPutFolder :
String;
end;
procedure FindAllFolders(RootFolder:
string; Mask:
string = '
*.*'; Recurse: Boolean = True;
var aDirList : TStringList );
var
FileReCovForm: TFileReCovForm;
implementation
{$R *.dfm}
procedure TFileReCovForm.SelectRFButtonClick(Sender: TObject);
begin
selectDirectory('
Select a Folder ', '
', FOutPutFolder);
RootFolderEdit.text := FOutPutFolder;
end;
procedure TFileReCovForm.Exit1Click(Sender: TObject);
begin
close;
end;
procedure FindAllFolders(RootFolder:
string; Mask:
string = '
*.*'; Recurse: Boolean = True;
var aDirList : TStringList );
var
SR: TSearchRec;
begin
if AnsiLastChar(RootFolder)^ <> '
\'
then
RootFolder := RootFolder + '
\';
if Recurse
then
if FindFirst(RootFolder + '
*.*', faAnyFile, SR) = 0
then
try
repeat
if SR.Attr
and faDirectory = faDirectory
then
if (SR.
Name <> '
.')
and (SR.
Name <> '
..')
then
begin
FindAllFolders(RootFolder + SR.
Name, Mask, Recurse);
aDirList.Add(RootFolder);
end;
until FindNext(SR) <> 0;
finally
FindClose(SR);
end;
end ;
procedure TFileReCovForm.GetAllFoldersButtonClick(Sender: TObject);
var DirStringList : TStringList;
begin
DirStringList:=TStringList.Create;
FindAllFolders(FOutPutFolder, '
' ,true, DirStringList );
memo1.Lines.Assign(DirStringList);
DirStringList.Free;
end;
end.