Page 1 of 1

How to change the path for all image files

Posted: Tue Oct 17, 2006 12:18 am
by steve1040
I have several html files which image files save to a folder with the same name as the html file. (Save page as)

I want to move all my files to one folder.

How do I do a bulk search for unique paths and move to image directory?
Before
aaa/thisimage.jpg
bbb/anotherimage.jpg
abc/andanotherimage.jpg

After
images/thisimage.jpg
images/anotherimage.jpg
images/andanotherimage.jpg

Thanks

Posted: Tue Oct 17, 2006 11:08 am
by ben_josephs
You haven't told us how to identify the part of the path to be replaced. Do either of these worK?
Find what: [a-z0-9._-]+/([a-z0-9._-]+\.jpg)
Replace with: images/\1

[X] Regular expression
Find what: (aaa|bbb|abc)/([a-z0-9._-]+\.jpg)
Replace with: images/\2

[X] Regular expression
These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax

Posted: Tue Oct 17, 2006 12:16 pm
by steve1040
ben_josephs wrote:You haven't told us how to identify the part of the path to be replaced.
Start
src="

To
/

Posted: Tue Oct 17, 2006 12:46 pm
by ben_josephs
Assuming that you mean you want to change all paths within all src attributes and that you want to replace all path components up to the last /:
Find what: src="[^"]+/
Replace with: src="images/

[X] Regular expression