PDA

View Full Version : Solved: Change filenames according to a list



jacksonworld
02-09-2006, 03:59 PM
Hi, I am looking to change some filenames according to a list. I hope someone can assist.

In one column, I have a list of current filenames, and in another column, I have a list of filenames to which I would like them to be changed.

ie. In my pathetic example below, I would like A.jpg changed to 1.jpg, and B.jpg to 2.jpg.

A.jpg 1.jpg
B.jpg 2.jpg

Can this be achieved? :dunno

Thank you

XLGibbs
02-09-2006, 04:31 PM
Try this template I created for just such a quandry. It is self explanatory, if you need more information..let me know.

The tempalte allows you to identify files and folders to copy/move and/or rename with multiple source and destinations.

If you need more, i have a KB submission with sample code for copying and/or renaming files located HERE (http://vbaexpress.com/kb/getarticle.php?kb_id=827)

jacksonworld
02-09-2006, 05:40 PM
Thanks. That template is very powerful. I know I will be using that in the future.

I have one question. I have unsuccessfully attempted to change the full filename, rather than enter something between the filename and extension. How do I do this?

XLGibbs
02-09-2006, 05:44 PM
Use this earlier version in which the custom file name option does what you need to by renaming everything left of the extension with whatever you type. Let me know if any issues....it was an earlier model of the same thing with the rename option being for full file name.

To rename Test.xls to Sample.xls you would type Sample in the custom rename column...

jacksonworld
02-09-2006, 06:02 PM
Which earlier version?

XLGibbs
02-09-2006, 06:09 PM
Whoops the file didnt stick as it was attached elsewhere..here it is...

jacksonworld
02-09-2006, 06:25 PM
It is performing the same function as the latest version.

ie. It is changing A.jpg to A_1.jpg, rather than 1.jpg.

Any ideas?

XLGibbs
02-09-2006, 06:46 PM
I just fixed it...this gives both options. In the rename box choose "Full Name" and you will type the desired name without the extension in the column for rename...sorry about that..this is a work in progress.

jacksonworld
02-09-2006, 07:49 PM
That is fantastic. Thanks so much. I just hope other people read this, because it is very useful. :thumb

XLGibbs
02-09-2006, 07:54 PM
Thanks! I actually have this pending addition to the VBAX Knowledge Base...I just have to update my submission with the modified tempalte you used.

Please mark the thread solved if you can. Thanks again!

Norie
02-09-2006, 10:05 PM
Gibbs

How exactly is this meant to work?

I've double-clicked all over the place and still nothing.:)

XLGibbs
02-10-2006, 05:43 AM
Are you kidding me?

Double click in column B or C to browse for a Source or Destination directory. Filename goes into Column A, you can choose rename options (or not). It is pretty self explanatory, and I just open the file submitted and it worked fine.

Let me know, I can email you a copy that I also know works fine. Sorry you are having trouble with it.

Norie
02-10-2006, 06:27 AM
Gibbs

I wasn't kidding.:)

Perhaps it was a problem my side.

I've just downloaded the file again and it does appear to work.

YellowLabPro
06-29-2007, 04:34 AM
Can this be used to rename the file name extension? If not is there another way to do so or can this be edited to handle this?

jolivanes
06-29-2007, 10:15 AM
I know it has been solved but here is another one.