Renaming files (1 Viewer)

Salbrox

Registered User.
Local time
Today, 12:44
Joined
Nov 10, 2012
Messages
49
Hi folks,

I have a bunch of .jpg files which reside in the same folder as my database. What i need to do is rename all of them at the click of a button. My database has a table with a column that lists all of their file names. What I want to do is add a column to the table that lists the new names, so that I have a column with the files current names and a column with the names that I want to re-name them to.

When I click the button i want it to apply the corresponding name from the new column to each jpg.


img1.jpg
img2.jpg
img3.jpg
img4.jpg

to

img1-121114-1F.jpg
img2-121114-2Z.jpg
img3-121114-6G.jpg
img4-121114-0L.jpg

How can this be done?

Any help mega appreciated.
 

spikepl

Eledittingent Beliped
Local time
Today, 13:44
Joined
Nov 3, 2010
Messages
6,144
Check Similar Threads at the bottom of this page.
 

Salbrox

Registered User.
Local time
Today, 12:44
Joined
Nov 10, 2012
Messages
49
Hmm cant seem to find an answer to what i'm looking for exactly. I know how to rename a file but i don't know how to do what I asked. I need to rename many files. I have a table with a column of files to be renamed and another column with the names i want to re name them to. Each name is unique. I need to rename them by clicking one button and have the code do it all.
 

Salbrox

Registered User.
Local time
Today, 12:44
Joined
Nov 10, 2012
Messages
49
Got it!

My problem was that I was looping through the files in the folder. What i needed to do was loop through the records in the table instead as each field contained the file name. I don;t know why i didn't see this sooner!

Thanks for the help.
 

Users who are viewing this thread

Top Bottom