做了个图片论坛,收录一直不台好。估计是描述大量重复造成的把!因为是批量传图片,也不可能一个个更改!于是,写了个工具批量改名!可以加关键词!
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,shellapi; type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; Button2: TButton; Button3: TButton; OpenDialog1: TOpenDialog; Memo1: TMemo; Edit2: TEdit; Label1: TLabel; Edit3: TEdit; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Arr: Array Of string ; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var found:integer; keyword,s,dirstr:string; rc:TSearchRec; begin memo1.Clear; dirstr:=edit1.Text;//任意目录 keyword:='*.jpg';//关键字 s:=dirstr+Trim(keyword); found:=findfirst(s,faAnyFile,rc); while found=0 do begin if (rc.Attr and faDirectory) <> 0 then // 判断是目录跳过 found:=FindNext(rc) else begin memo1.Lines.Add(ExtractFileName(rc.Name)); found:=FindNext(rc); end end; button3.Enabled:=true; end; procedure TForm1.Button2Click(Sender: TObject); begin If opendialog1.Execute then begin edit1.Text:=opendialog1.FileName; end; edit1.Text:=ExtractFilePath(edit1.Text); button1.Enabled:=true; end; procedure TForm1.Button3Click(Sender: TObject); var i:integer; begin for i:=0 to memo1.Lines.Count-1 do begin Randomize; renamefile(pchar(edit1.Text + memo1.Lines.Strings[i]),pchar(edit1.Text + edit2.Text + inttostr(Random(10000000000)) + edit3.Text +'.jpg')) end; button1.Click; end; end.
在关键词后面两个框中加入您想加的词!大家试试,可能会有意想不到的收获!
发表评论