unit MyPad1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, FileCtrl, ComCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Memo1: TMemo;
BitBtn2: TBitBtn;
DriveComboBox1: TDriveComboBox;
DirectoryListBox1: TDirectoryListBox;
Edit1: TEdit;
BitBtn3: TBitBtn;
ProgressBar1: TProgressBar;
Panel1: TPanel;
Panel2: TPanel;
BitBtn1: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Panel3: TPanel;
Panel4: TPanel;
Label3: TLabel;
procedure DriveComboBox1Change(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure DirectoryListBox1Change(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
private
{ Private-Deklarationen }
public
procedure GetFiles(
const Path:
string);
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Weiter:Boolean;
a:integer;
implementation
{$R *.dfm}
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
a:=0;
Memo1.Clear;
Form1.GetFiles(DirectoryListbox1.Directory+'
\');
end;
procedure TForm1.GetFiles(
const Path:
string);
var
SearchRec: TSearchRec;
p:
string;
begin
Label1.Caption:='
';
p := path + '
*.*';
if FindFirst(p, faAnyFile, SearchRec) = 0
then
begin
repeat
if (SearchRec.Attr
and faDirectory) = faDirectory
then
begin
if (SearchRec.
Name <> '
.')
and (SearchRec.
Name <> '
..')
then
GetFiles(Path + SearchRec.
Name + '
\');
end
else begin
Form1.Memo1.Lines.Add(Path + SearchRec.
Name);
a:=a+1;
Refresh;
Application.ProcessMessages;
ProgressBar1.StepIt;
end;
until
FindNext(SearchRec) <> 0;
FindClose(SearchRec);
end;
ProgressBar1.Position:=0;
Label1.Caption:=IntToStr(a) +'
Dateien gescannt';
end;
procedure TForm1.DriveComboBox1Change(Sender: TObject);
begin
DirectoryListbox1.Drive:=DriveComboBox1.Drive;
end;
procedure TForm1.DirectoryListBox1Change(Sender: TObject);
begin
Edit1.Text:=DirectoryListbox1.Directory;
DirectoryListbox1.DirLabel.Hint:=DirectoryListbox1.Directory;
DirectoryListbox1.Hint:=DirectoryListbox1.Directory;
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
var
i:integer;
begin
if Memo1.Lines.Count>0
then begin
if MessageDlg('
Wirklich umbennen?',mtwarning,[mbOK,mbCancel],0)=mrOk
then begin
ProgressBar1.Max:=Memo1.Lines.Count;
for i:=0
to Memo1.Lines.Count-1
do begin
if pos('
.wav',Memo1.Lines.Strings[i])<>0
then
RenameFile(Memo1.Lines.Strings[i],StringReplace(Memo1.Lines.Strings[i],'
.wav','
.mp3',[rfreplaceall]));
if pos('
.MP3',Memo1.Lines.Strings[i])<>0
then
RenameFile(Memo1.Lines.Strings[i],StringReplace(Memo1.Lines.Strings[i],'
.wma','
.mp3',[rfreplaceall]));
if pos('
.avi3',Memo1.Lines.Strings[i])<>0
then
ProgressBar1.Position:=i;
refresh;
end;
end;
ProgressBar1.Position:=0;
end
else MessageDlg('
Keine Dateien gescannt!',mtinformation,[mbOk],0);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Memo1.Clear;
a:=0;
Label1.Caption:='
';
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
Weiter:=true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//DirectoryListbox1.Directory:='C:\Dokumente und Einstellungen\Maxl\Desktop\Neuer Ordner';
end;
procedure TForm1.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose:=MessageDlg('
MyChanger beenden?',mtconfirmation,[mbYes,mbNo],0)=mrYes;
end;
end.