How to change the path for all image files

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

How to change the path for all image files

Post 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
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

Post by steve1040 »

ben_josephs wrote:You haven't told us how to identify the part of the path to be replaced.
Start
src="

To
/
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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
Post Reply