Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing files name

Status
Not open for further replies.

ooananoo

Programmer
Apr 27, 2001
4
0
0
US
I wanted to change all my .gif files under my folder(include all the gif files in all sub folders) automatically naming from Figure1.gif to Figure10.gif( the maximum number will be given) Because I have lots of gif files so I wanted to write a Delphi program for doing this as a exercise. I'm learing this language myself. If anyone could show me some simple code to do this I would really appreciate.
Thanks!
 
In Delphi you can simply use the RenameFile function:


EG

Code:
if not RenameFile('IMAGE1.GIF', 'IMAGE01.GIF') then
   ErrorMsg('Error renaming file!');

X-)
Billy H

bhogar@acxiom.co.uk
 
A simple way to find the files in sub folders is to
use a combination of the 'filesearch' function and a directory outline component (samples page).
The Items.strings[X] property holds the folder names.
Loop through these these to get your folders/sub folders
and use filesearch to locate the files in each.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top