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 2010 unicode

Delphi vclzip实现分卷压缩

Delphi 2009 泛型容器单元(generics.collections)[1]: tlist<t>

Delphi截获和干扰窗体最小化�p最大化和关闭消息

Delphi将字符串转换成utf8编码的函数

Delphi stringtowidestring widestringtostring

Delphi tdownloadurl下载网络文件

Delphi 关闭xp保护 替换explorer.exe

Delphi 获取系统服务service id

Delphi:取得浏览器地址,网址(支持ie,firefox)

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



打赏

取消

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

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

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

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

评论

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