This message was edited by porodoro at 2006-4-3 13:0:6
:
This message was edited by zibadian at 2006-4-3 7:26:45
: :
This message was edited by jobromedia at 2006-4-3 6:35:56
: : : : Just wondering how I can rename files from Delphi. Can somebody help me out?
: : : :
: : : Use the RenameFile() function in the SysUtils.
: : :
: : Ok that is a quite obvious. But if I just need to rename the extension part? Can this be done?
: :
: : :edit: I discovered the chaneextension routine, but it doesn't give any visible effect, no files are changed. What am I doing wrong?
: :
: :
procedure Revamp(i:integer; var s:string);
: : var ns:string;
: : begin
: : case i of
: : 1: begin
: : ns:= ChangeFileExt(s,'.DLL');
: : end;
: : 2: begin
: : ns:= ChangeFileExt(s,'.EXE');
: : end;
: : 3: begin
: : ns:= ChangeFileExt(s,'.MP3');
: : end;
: : 4: begin
: : ns:= ChangeFileExt(s,'.OGG');
: : end;
: : 5: begin
: : ns:= ChangeFileExt(s,'.RAR');
: : end;
: : 6: begin
: : ns:= ChangeFileExt(s,'.ZIP');
: : end;
: : else begin
: : {Nothing to do}
: : end;
: : end;
: : end;
: :
: : I have to revamp these files to make them work on my internet site that's why I need this to work.
: :
: :
: :
: :
: :
:
: NewFilename := Copy(OldFilename, 1, LastDelimiter('.', OldFilename))+NewExtension;
:
:
:
:
or
ChangefileEXT( pchar( EXTRACTfilepath(Application.exename) +'FILE.EXE')
,'.TXT');