|
|
|
|
![]() ![]() |
Nov 30 2007, 08:39 PM
Post
#1
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 1 Joined: 30-November 07 Member No.: 26,571 |
Hey everyone, my problem is I have a folder full of images that I need to rename to match a list of names I have in an excel spreadsheet. There are roughly 1200 images and I was wondering if there was any way to automate this process.
The files are in the following convention, a four character prefix, underscore, a product name, underscore, "F08.jpg" Example: AA4G_NuptseJkt_F08.jpg The Excel list is in the same convention except that the product name is not abbreviated. Example: AA4G_NuptseJacket_F08.jpg When loading the images to be displayed on our website the software won't recognize the images unless the image names match with the names on the list. Can anyone suggest anything to automatically rename the images based on the four character prefix from the list? Also, I think it should be mentioned that the prefixes are all different. |
|
|
|
Dec 1 2007, 03:10 AM
Post
#2
|
|
|
Absolute Newbie Group: Admin Posts: 884 Joined: 20-February 05 From: Indianapolis, Indiana, USA (Midwest) Member No.: 2,714 |
I may be able to write a script in PHP that will do the job for you but I would need a little data.
Perhaps a list of 10 filenames and their corresponding spreadsheet match. I could then run a few tests to see how to best write the script. It would probably start by building an array for each then bridge them so that item 1 in array1 was the match in array2 etc... Then just rename file with name in array1 with the name from the same in array2. I'll await your reply. vujsa |
|
|
|
Dec 3 2007, 06:29 AM
Post
#3
|
|
|
Advanced Member Group: Members Posts: 170 Joined: 30-July 07 Member No.: 23,704 |
Or instead of using PHP to code, you can try using the Microsoft Excel Macro Editor to create a small program to do the file renaming for you. There's this website that I've found it quite useful, at least it gives you the basic idea. http://www.mrexcel.com/archive/VBA/4832.html.
The idea is by reading all the image files from that folder and moving the file object to what is stated in the excel spreadsheet. 1. create another folder to store all renamed images. 2. have a loop reading all the images from the current folder. 3. then read the stated name from the list of worksheet given. 4. moving the current selected images to the stated name to the new folder (created at step 1). I've also found some information and sample code for renaming files in Excel in the internet. You can reference to it if you want. But of course if all these are pretty troublesome, then maybe you can wait for vujsa program. Hope some of it help you started. Cheers This post has been edited by kelvinmaki: Dec 3 2007, 06:29 AM
Attached File(s)
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 21st August 2008 - 11:30 PM |