D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] More scripting silliness...



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to build a mirroring system for my ecommerce store at 
http://www.smssat.biz in order to improve performance.  Thanks to the help of 
this group, I've got a script that renames all of the files in the "static" 
version to remove the variable string from the filenames.

However, I was hoping that I'd just be able to use relative links to get over 
the problem of removing the "link" name from the URL, ie. the relative link 
effectively changes because the files have been moved to the HTML directory:

http://www.smssat.biz/sms.ic/index.html -> http://www.smssat.biz/index.html

However, what I was forgetting is that Interchange uses strokes ('slashes' if 
you prefer, but that sounds a bit violent to me) in the search string.  Why, 
I really don't know, it seems a bit stupid to me and it might be the reason 
why Google is refusing to index it :-(  But the main problem is that it mucks 
up the relative links.

Eg. you run a search and get sent to this location:
http://www.smssat.biz/scan/fi=products/sp=results_big_thumb/st=db/co=yes/sf=category/se=OtherReceivers/va=banner_image=/va=banner_text=.html?id=f8YyQGtr

Where there is a relative link to "./index.html", but of course that now 
translates to:
http://www.smssat.biz/scan/fi=products/sp=results_big_thumb/st=db/co=yes/sf=category/se=OtherReceivers/va=banner_image=/index.html

I hope this makes sense!  So anyway, the upshot of this is that I am going to 
need a script that rewrites the links in every page to take out the "sms.ic" 
bit.  Thus the dynamic version can spit out working links (with "sms.ic") and 
wget can spider it properly (without spidering it's own mirror), but the 
static version links to itself.  And everybody is happy and world peace is 
finally acheived ;-)

Can anybody suggest a script to do it?

Cheers,

Jon

- ----------------
Current script (well, the 'core' bit anyway), for reference:

find . -type f -name '*' |while read -r AFILE
do
 NEWNAME=`expr "$AFILE" : "\(.*\)?"`
 if [ -a $NEWNAME ]
 then
    echo Duplicate file name $NEWNAME would be created
 else
     mv $AFILE $NEWNAME
 fi
done
- ----------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/AwoueTVvFHAhe5cRAmipAJ9uKyuNlS1KKuNvUhJLC3XneXSzKQCdGcd6
RgRSkPRWCbxuHBiuBvgP0Lw=
=EHs1
-----END PGP SIGNATURE-----


--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly