Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How do I rename files? Posted by jobromedia on 31 Mar 2006 at 9:29 AM
Just wondering how I can rename files from Delphi. Can somebody help me out?
Report
Re: How do I rename files? Posted by zibadian on 31 Mar 2006 at 10:56 AM
: Just wondering how I can rename files from Delphi. Can somebody help me out?
:
Use the RenameFile() function in the SysUtils.
Report
Re: How do I rename files? Posted by jobromedia on 3 Apr 2006 at 6:17 AM
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.




Report
Re: How do I rename files? Posted by zibadian on 3 Apr 2006 at 7:26 AM
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;



Report
Re: How do I rename files? Posted by porodoro on 3 Apr 2006 at 12:59 PM
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');


Report
Re: How do I rename files? Posted by advanced on 3 Apr 2010 at 9:16 AM
The library path/search path is a per user option, so
the virus could change that (inserting a path to a
modified DCU) and still produce the same behavior as now.
This is also true with protected Program Files
directory in Vista.

Bulk Rename
Report
Re: How do I rename files? Posted by donnaj867 on 6 Jul 2010 at 1:18 AM

Hi, I am a new member of forum. Would a newcomer be warmly welcome here? Good day you guys!!!



__________________
[url=http://moviesonlinefree.biz]Watch Predators Online Free[/url]




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.