如何重命名一个目录,就是将目录改名!解决马上结贴。

解决方案 »

  1.   

    用Rename。看Delphi自己的例子:uses Dialogs;
    var  f : file;
    begin
      OpenDialog1.Title := 'Choose a file... ';
      if OpenDialog1.Execute then 
      begin
        SaveDialog1.Title := 'Rename to...';
        if SaveDialog1.Execute then 
        begin 
          AssignFile(f, OpenDialog1.FileName);
          Canvas.TextOut(5, 10, 'Renaming ' + OpenDialog1.FileName + 
                         ' to ' + SaveDialog1.FileName);
          Rename(f, SaveDialog1.FileName);
        end;
      end;end;
      

  2.   

    可以,简单,要保存程序后。
    renamefile('H:\aa','H:\bbaa');
      

  3.   

    if  MoveFile('d:\新建文件夹','d:\YOURSTUFF') then
        showmessage('文件夹更名成功!');BOOL MoveFile(     LPCTSTR lpExistingFileName, // address of name of the existing file   
        LPCTSTR lpNewFileName // address of new name for the file 
       );   Points to a null-terminated string that specifies the new name of a file or directory. The new name must not already exist. A new file may be on a different file system or drive. A new directory must be on the same drive.
      

  4.   

    TO:  Ben_Ladan(兰企鹅) 
    你一定没有试。用Rename是可以改文件夹(即目录)的名字的,只要你保证两个参数都是正确的目录。