怎样用程序新建一个文件夹,请各位大虾帮忙。

解决方案 »

  1.   

    e.g:
    procedure TForm1.Button1Click(Sender: TObject);
    begin
        createdir('c:\1');
    end;
      

  2.   

    procedure makedir(modulname,pathname,dirname,filepath:string);
    begin
    try
        if not directoryexists(frootpath+modulname) then
          createdir(FRootPath+modulname);
        if not DirectoryExists(FRootPath+modulname+'\'+pathname) then
        createdir(FRootPath+modulname+'\'+pathname);
        if not directoryexists(FRootPath+modulname+'\'+pathname+'\'+dirname) then
        createdir(FRootPath+modulname+'\'+pathname+'\'+dirname);
        if filepath<>'' then
        if not directoryexists(FRootPath+modulname+'\'+pathname+'\'+dirname+'\'+filepath) then
        createdir(FRootPath+modulname+'\'+pathname+'\'+dirname+'\'+filepath)
        except
        On E:Exception do begin
        abort;
        end;
        end;
        banjin.N21.Enabled:=true;
       liucheng.MenuItem1.Enabled:=true;
       yanzheng.N21.Enabled:=true;
        banjin.SpeedButton1.Enabled:=true;
        liucheng.SpeedButton1.Enabled:=true;
        yanzheng.SpeedButton1.Enabled:=true;
        banjin.toolbutton1.Enabled:=true;
        liucheng.toolbutton1.Enabled:=true;
        yanzheng.toolbutton1.Enabled:=true;
        if filepath='' then
        filespath:=FRootPath+modulname+'\'+pathname+'\'+dirname+'\'+filepath else
        filespath:=FRootPath+modulname+'\'+pathname+'\'+dirname+'\'+filepath+'\';
        banjin.StatusBar1.Panels[0].Text:='你目前所在的位置:'+filespath;
        liucheng.StatusBar1.Panels[0].Text:='你目前所在的位置:'+filespath;
        yanzheng.StatusBar1.Panels[0].Text:='你目前所在的位置:'+filespath;
    end;