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 无dll版下载者

Delphi打开文件夹并定位到一个文件

Delphi 如何判断html编码格式,解决乱码问题

Delphi 查询进程名进程id/进程路径 父进程/子进程

winapi 字符及字符串函数(14): chartooem、oemtochar

Delphi 获取安卓手机wifi信息(xe8)

Delphi xe6调用android标准功能

Delphi 保证当前程序显示在最前

Delphi实现屏幕抓图

Delphi 处理链接和文件路径结尾\和/

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



打赏

取消

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

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

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

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

评论

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