tags:

views:

600

answers:

4

Hello,

I have an .HTML file that has many photos attached to it for displaying a photo gallery. I'm replacing old photos with new ones, and I'm thinking there must be a more intelligent way than simply copying and pasting repetitive file names.

I would love to be able to replace and increment a file name on each replace, starting at a base file name of my choosing. For example...

...images/69thStreet010.jpg
...images/69thStreet011.jpg
...images/69thStreet012.jpg

Basically performing a CTRL+F and REPLACE '69thStreet010.jpg' with...

...images/xyz001.jpg
...images/xyz002.jpg
...images/xyz003.jpg

And so on until I want it to stop. Anyone here have any suggestions? Thanks a lot!

-K.R.

UPDATE: I should also add, I'm using Notepad++ to edit my files.

+1  A: 

It's time for you to learn scripting languages. Python/Ruby/Perl can do this in a few lines by using simple regular expressions and a directory listing.

Frank Krueger
+1  A: 

If your S&R supports Regex, use this. Search term:

images/69thStreet([0-9]+).jpg

Replace term:

images/xyz$1.jpg
Dykam
He changed his numbering start. I don't know of any editors that allow you to apply arithmetic expressions to match results.
Frank Krueger
Dykam, This really helps a lot. Thank you so much!-K.R.
If it was the solution you needed, nice I could help you out.
Dykam
A: 

There is. Create your list of photos using a python script that looks at whatever directory you want, and renames or just lists all the file names. Then go from that to a python script that generates the HTML you need (should be very easy at this point). Then copy & paste that.

Python is very easy to use, you will be able to download it in 5 minutes & find a tutorial for reading / changing file names in another 10 minutes.

ryansstack
A: 

I just use Excel & Notepad++

Create a column of incrementing numbers in Excel. Then in the next (or previous) column, put in the line you wish to merge w/ the incrementing numbers. For instance:

file00  |  1  |  .jpg
file00  |  2  |  .jpg

Etc.

Then copy/paste the thing into Notepad++ (or use Excel's CONCATENATE function if the job is simple) and do a replacement.

Vasiliy Deych