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 txt编码互转 ansi utf-8

如何把 Delphi 自带的内存泄露写到日志

Delphi 调用dll运行正常,退出时弹出错误解决办法

Delphi 获取含跨域网址的框架网页的源码

Delphi用邻域平均法对图像进行平滑处理

Delphi 三个消息函数的威力

Delphi tdownloadurl下载网络文件

Delphi xe5 给edit增加自定义按钮

Delphi xe5 android手机端转换ansi字符串

Delphi tms web core js callproc

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



打赏

取消

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

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

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

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

评论

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