changing links (was Re: [thelist] Copying HTML from PC to Mac)
aardvark
roselli at earthlink.net
Thu Jul 20 22:30:22 CDT 2000
> -----Original Message-----
> From: Sam-I-Am
>
> so people always say.. but I've yet to find a
> comprehensive and
> practical solution to the problem of manipulating
> links across a whole site.
under the circumstances, i cited a regexp solution because the file name shift in this case is
very well-understood...
truncated long file names (to DOS 8.3 names) are always truncated the same way... if it's
greater than 8.3, then take the first 6 letters before the dot, add a '~', add a number (start with
1, only go higher if the first 6 letters are the same as another file), and then add the dot and the
first three letters of the extension...
when you get over 9 versions of the same first six letters, then you do the first five letters of
the lon file name, do the '~', and then start counting at 10... then the dot and the first three
letters of the extension... etc...
so, given these rules, i was suggesting that a regexp in your language-o-choice could handle
the conversion of all the links in the HTML pages... i've had to do a couple variations on this
before, but it was before i knew anything about scripting, so i had my local perl monkey do it up
for me... so no, i'm not talking about a generalized tool for changing all the links in a site, just this
very particular problem and a possible solution...
anyway... this:
reallylongfilename_b.txt
reallylongfilename_a.txt
reallylongfilename_c.txt
reallylongfilename_d.txt
reallylongfilename_e.txt
reallylongfilename_f.txt
reallylongfilename_g.txt
reallylongfilename_h.txt
reallylongfilename_i.txt
reallylongfilename_j.txt
reallylongfilename_k.txt
longfilename_k.text
becomes this:
REALLY~2 TXT
REALLY~1 TXT
REALLY~3 TXT
REALLY~4 TXT
REALLY~5 TXT
REALLY~6 TXT
REALLY~7 TXT
REALLY~8 TXT
REALLY~9 TXT
REALL~10 TXT
REALL~11 TXT
LONGFI~1 TEX
More information about the thelist
mailing list