彻底删除文件(Delphi源码)
更新时间:2024-07-06 01:41:02 阅读量: 综合文库 文档下载
- delphi 删除文件推荐度:
- 相关推荐
彻底删除文件源码
unit Unit1;
interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls; type
TForm1 = class(TForm) Button1: TButton;
OpenDialog1: TOpenDialog; Button2: TButton; Edit1: TEdit;
ProgressBar1: TProgressBar; Button3: TButton; Button4: TButton; Timer1: TTimer; Button5: TButton;
procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); private
{ Private declarations } public
{ Public declarations } end; var
Form1: TForm1; FileName:String;
implementation
{$R *.dfm}
Procedure DelOne(FileName:String); var
f: file of byte; n: byte; i:integer;
SizeInt:Int64; begin
AssignFile(f, FileName); Reset(f);
SizeInt:=FileSize(f); n := 0;
for i := 1 to SizeInt do begin
BlockWrite(f, n, 1); end;
CloseFile(f); end;
Procedure DelTwo(FileName:String); var
f: file of byte; n: byte; i:integer; begin
AssignFile(f, FileName); Reset(f); n := 1;
for i := 1 to FileSize(f) do begin
BlockWrite(f, n, 1); end;
CloseFile(f); end;
Procedure DelThree(FileName:String); var
f: file of byte; n: byte; i:integer; begin
Randomize;
AssignFile(f, FileName); Reset(f);
for i := 1 to FileSize(f) do begin
n :=Random(3); BlockWrite(f, n, 1); end;
CloseFile(f);
end;
Procedure DelFour(FileName:String); var
f: file of byte; n: byte; i:integer; begin
Randomize;
AssignFile(f, FileName); Reset(f);
for i := 1 to FileSize(f) do begin
n :=Random(4); BlockWrite(f, n, 1); end;
CloseFile(f); end;
Procedure Delfive(FileName:String); var
f: file of byte; n: byte; i:integer; begin
Randomize;
AssignFile(f, FileName); Reset(f);
for i := 1 to FileSize(f) do begin
n :=Random(5); BlockWrite(f, n, 1); end;
CloseFile(f); end;
Procedure Delsix(FileName:String); var
f: file of byte; n: byte; i:integer; begin
Randomize;
AssignFile(f, FileName);
Reset(f);
for i := 1 to FileSize(f) do begin
n :=Random(6); BlockWrite(f, n, 1); end;
CloseFile(f); end;
Procedure Delsven(FileName:String); var
f: file of byte; n: byte; i:integer; begin
Randomize;
AssignFile(f, FileName); Reset(f);
for i := 1 to FileSize(f) do begin
n :=Random(7); BlockWrite(f, n, 1); end;
CloseFile(f); end;
Procedure DelEt(FileName:String); var
f: file of byte; n: byte; i:integer; begin
Randomize;
AssignFile(f, FileName); Reset(f);
for i := 1 to FileSize(f) do begin
n :=Random(8); BlockWrite(f, n, 1); end;
CloseFile(f); end;
Procedure DelNine(FileName:String);
var
f: file of byte; n: byte; i:integer; begin
Randomize;
AssignFile(f, FileName); Reset(f);
for i := 1 to FileSize(f) do begin
n :=Random(9); BlockWrite(f, n, 1); end;
CloseFile(f); end;
procedure TForm1.Button1Click(Sender: TObject); begin
DelOne(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelTwo(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelThree(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelFour(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; Delfive(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelSix(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; Delsven(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelEt(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelNine(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DeleteFile(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; ShowMessage('OK'); end;
procedure TForm1.Button2Click(Sender: TObject); begin
if OpenDialog1.Execute then
Edit1.Text:=OpenDialog1.FileName; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin
DelOne(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelTwo(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelThree(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelFour(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; Delfive(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelSix(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; Delsven(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelEt(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelNine(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DeleteFile(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; ShowMessage('OK'); Timer1.Enabled:=False; end;
procedure TForm1.Button3Click(Sender: TObject); begin
Timer1.Enabled:=True; end;
procedure TForm1.Button4Click(Sender: TObject); begin
Timer1.Enabled:=False; end; end.
Edit1.Text:=OpenDialog1.FileName; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin
DelOne(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelTwo(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelThree(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelFour(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; Delfive(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelSix(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; Delsven(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelEt(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DelNine(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; DeleteFile(Edit1.Text);
ProgressBar1.Position:=ProgressBar1.Position+1; ShowMessage('OK'); Timer1.Enabled:=False; end;
procedure TForm1.Button3Click(Sender: TObject); begin
Timer1.Enabled:=True; end;
procedure TForm1.Button4Click(Sender: TObject); begin
Timer1.Enabled:=False; end; end.
正在阅读:
彻底删除文件(Delphi源码)07-06
西师版小学数学三年级数学上册:《两位数除以一位数的笔算》同步03-01
新劳动合同书(范本)10-11
FANUC 0i MD 加装四轴设定方法10-22
LSMW使用IDoc方法的简单介绍01-21
矿物岩石学练习题09-16
水浒传120回每回故事梗概12-17
- 多层物业服务方案
- (审判实务)习惯法与少数民族地区民间纠纷解决问题(孙 潋)
- 人教版新课标六年级下册语文全册教案
- 词语打卡
- photoshop实习报告
- 钢结构设计原理综合测试2
- 2014年期末练习题
- 高中数学中的逆向思维解题方法探讨
- 名师原创 全国通用2014-2015学年高二寒假作业 政治(一)Word版
- 北航《建筑结构检测鉴定与加固》在线作业三
- XX县卫生监督所工程建设项目可行性研究报告
- 小学四年级观察作文经典评语
- 浅谈110KV变电站电气一次设计-程泉焱(1)
- 安全员考试题库
- 国家电网公司变电运维管理规定(试行)
- 义务教育课程标准稿征求意见提纲
- 教学秘书面试技巧
- 钢结构工程施工组织设计
- 水利工程概论论文
- 09届九年级数学第四次模拟试卷
- 源码
- 彻底
- 删除
- 文件
- Delphi
- 河北省2012年高考分数线
- 试论非婚同居财产法律关系
- 《大学物理习题集》(上)习题解答
- 门禁控制系统建议方案 - 图文
- 医学免疫学教学有感
- 2019年高考物理复习备考的计划
- 2016年韩山师范学院本科插班生《C语言程序设计》试卷
- XX年教育工作年度目标考核自查报告_1
- 小学五年级语文课内阅读练习题
- 《简明法语教程》1—8课知识点总结
- 二轮复习专项训练精品系列-选择题15套(含答案)
- 奥数五年级立方体习题
- 温州市文艺家协会会员信息采集表 - 图文
- 5盐城中学2013届高三第二次模拟考试化学试题
- 314(40+64+40)m 悬灌梁施工方案
- 四大卫星导航系统伪距单点定位性能对比分解
- 儿科诊疗常规(带目录)
- 棚户区道路工程施工组织设计
- 电子商务系统设计 - 实践教学指导书
- 消费者行为_个性