How to change the extension of the file? tried this:

ChangeFileExt('1.php', '.jpg'); 

so:

  RenameFile('1.php', '1.jpg') 

no result in both cases

    2 answers 2

    @Nica Krivosheya , the first case has nothing to do with interaction with the file system, although the name of the function signature "says" as if it were. In fact, nothing of the kind, this function only returns a string "file path" with a modified extension specified in the second parameter. But the second function is already directly related to the Windows file system. She, as her name says, renames the file. And she, by the way, works for me:

     RenameFile('C:\coc3.js','C:\coc3.txt'); 

    Your function may not work, for example, due to the fact that your program does not have access rights to this file (rights to rename, delete, etc.). Most likely, UAC interferes, well, or you just do not specify the full path to the file.

      RenameFile is a function.

      http://www.delphisources.ru/pages/faq/faq_delphi_basics/RenameFile.php.html