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 随机字符3

Delphi 实现数据库读取图片文件

Delphi 把exe可执行文件等作为资源包含在Delphi编译文件中

Delphi tms web core 在线pdf教程

Delphi中使用ado连接带密码的access

Delphi serial number of an usb flash drive 获取u盘硬件序列号

Delphi guid单元

Delphi 查看指定进程占用端口

Delphi 文件大小 显示k kb mb gb tb

Delphi10.2.3解决的一个json问题

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



打赏

取消

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

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

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

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

评论

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