delphi的判断文件和文件夹


本文整理自网络,侵删。

 //判断
if not Fileexists('c:\2.exe') then
begin
//如果文件不存在
end;
if not Directoryexists('C:\Program Files\test') then
begin
//如果文件夹不存在
end;
//
delphi创建和删除文件夹
1.本目录创建和删除test文件夹
uses段中添加对ShellApi
CreateDirectory(PChar(ExtractFilePath(ParamStr(0))+'Test'),nil);//创建
RemoveDirectory (Pchar(ExtractFilePath(ParamStr(0))+'Test'))//删除

2.在指定的目录创建和删除test文件夹
CreateDirectory(PChar('C:\Program Files\Test'),nil); //创建

RemoveDirectory (PChar('C:\Program Files\Test'),nil); //删除

DeleteFile('c:\new.exe') ; //删除文件

相关阅读 >>

Delphi2010安装twordapplication控件

Delphi fmx窗体中控件对齐方式介绍

Delphi xe7上启用android蓝牙

Delphi 判断文件是否存在

Delphi编写的lpk.dll专杀,可清理rar

Delphi 校验注册码时的技巧

Delphixe 如何调用stringtojstring

Delphi 数字签名添加器源码

Delphi datasettojson jsontodataset

Delphi now、date、time、currentyear - 当前日期

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...