开发工具:
文件大小: 10kb
下载次数: 0
上传时间: 2011-05-06
详细说明: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, FileCtrl; type TForm1 = class(TForm) DriveComboBox1: TDriveComboBox; FileListBox1: TFileListBox; DirectoryListBox1: TDirectoryListBox; Button1: TButton; Button2: TButton; ListBox1: TListBox; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Edit1: TEdit; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: T Label; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Edit2: TEdit; Label10: TLabel; Label11: TLabel; Edit3: TEdit; Label12: TLabel; procedure Start(Sender: TObject); procedure changedrive(Sender: TObject); procedure SelectFolder(Sender: TObject); procedure DirectoryListBox1Change(Sender: TObject); procedure Addit(Sender: TObject); procedure Del(Sender: TObject); procedure Savelist(Sender: TObject); procedure foldercheck(Sender: TObject); procedure Search(Sender: TObject); procedure findlist(sender: TObject); procedure main(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; Bak:string; implementation {$R *.DFM} procedure TForm1.Start(Sender: TObject); {copies files when backup required only replaces ones with newer time date} var dir,newstr,oldstr,s,ss:string; d,f,n,nod,nof,age,bakage,len,lendir,newF:integer; {number of directories ,number of files} a,b:boolean; begin NewF:=0; a:=false; dir:=DirectoryListBox1.Directory; nod:=ListBox1.items.count; for d:=0 to (nod-1) do begin DirectoryListBox1.Directory:=listbox1.items[d]; FileListBox1.Directory:=DirectoryListBox1.Directory; dir:=DirectoryListBox1.Directory; nof:=FileListBox1.items.count; for f:=0 to (nof-1) do begin oldstr:=Bak; newstr:=dir+'\'+FilelistBox1.items[f]; lendir:=length(dir); {oldstr:=Bak+'\'+copy(dir,4,len-3);} n:=pos('\',dir); s:=copy(dir,n+1,lendir); n:=pos('\',s); repeat ss:=copy(s,1,n-1); oldstr:=oldstr+'\'+ss; b:=DirectoryExists(oldstr); if b=false then mkdir(oldstr); len:=length(oldstr); s:=copy(dir,len-2,lendir); n:=pos('\',s); until n=0; len:=length(newstr); oldstr:=bak+'\'+copy(newstr,4,len-3); age:=fileage(newstr); bakage:=Fileage(oldstr); if (age0 then begin sTemp:=copy(s,1,n-1); sFront:=sFront+'\'+sTemp; b:=DirectoryExists(sFront); if b=false then MkDir(sFront); Delete(s,1,n); end; until n=0; end; end; procedure TForm1.Search(Sender: TObject); {Takes folder list in listbox1 and looks to see if one next level down has new folders. If yes then it makes the new folder and adds it to the listbox this enables bakup of new web pages with a PageFiles folder then saves list Does not seem to add to list box new directories found so that it digs deeper next time appears to add directory tried this saw it in .txt file (notpad) but on closing it must save in it original form as it has them gone has this to do with the blank lie that gets added in??????????????????} var nod,numinbox,nn,d,NewDir,len:integer; s,ss,dir:string; b:boolean; begin NewDir:=0; nod:=ListBox1.items.count; for d:=0 to nod-1 do begin DirectoryListBox1.Directory:=listbox1.items[d]; FileListBox1.Directory:=DirectoryListBox1.Directory; dir:=DirectoryListBox1.Directory; numinbox:=directoryListBox1.items.count; {top:=directoryListBox1.items[0]; top2nd:=directoryListBox1.items[1];} for nn:=3 to numinbox-1 do begin s:=listbox1.items[d]+'\'+DirectoryListBox1.items[nn]; b:=DirectoryExists(s); if b=true then begin len:=length(s); ss:=copy(s,4,len); ss:=Bak+'\'+ss; b:=DirectoryExists(ss); if b=false then begin mkdir(ss); listbox1.items.add(s); NewDir:=NewDir+1; end; end; end; end; Edit2.text:=inttostr(NewDir); savelist(sender); end; procedure TForm1.main(Sender: TObject); begin findlist(sender); {find list of directories from disk}; foldercheck(sender);{check directories from list exist and if not make them} search(sender); {search for folder one level down} start(sender); {save files if there is a more up to date one} end; end. ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.