delphi 新建文件夹函数


本文整理自网络,侵删。

 procedure MakeDir(Dir: String);
function Last(What: String; Where: String): Integer;
var
    Ind : Integer;
begin
    Result := 0;
    for Ind := (Length(Where)-Length(What)+1) downto 1 do
        if Copy(Where, Ind, Length(What)) = What then begin
           Result := Ind;
           Break;
        end;
end;
var
PrevDir : String;
Ind     : Integer;
begin
if Copy(Dir,2,1) <> ':' then
     if Copy(Dir,3,1) <> '\' then
        if Copy(Dir,1,1) = '\' then
           Dir := 'C:'+Dir
        else
           Dir := 'C:\'+Dir
     else
        Dir := 'C:'+Dir; if not DirectoryExists(Dir) then begin
     Ind     := Last('\', Dir);
     PrevDir := Copy(Dir, 1, Ind-1);
     if not DirectoryExists(PrevDir) then
        MakeDir(PrevDir);
     CreateDir(Dir);
end;
end;

相关阅读 >>

Delphi编程启动服务停止服务新建服务的方法

Delphi xe中使用tchart绘制平滑曲线

Delphi里label显示多行文本的两种方法

Delphi和金山词霸制作批量单词翻译

Delphi 新建文件夹函数

Delphi post登陆Delphi盒子论坛源码

Delphi从excel读取数据存入数据库demo

Delphi 用ado从文本文件中导入数据库的两种方法比较

Delphi 根据邮箱地址分离出@前的内容

Delphi 获取系统所有磁盘盘符

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



打赏

取消

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

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

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

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

评论

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