rebols,
Here's a quick script I just threw together to help move a web site from a
non-case sensitive file system to a case sensitive one.
eg moving your website from NT to a linux box
It simply checks inside the src and img tags and lowercases the contents. Then
it lowercases all of the file names.
Will fail with javascript references to files, but it should be a good starting
point for anyone trying to move servers.
It uses the recursive-files function from rebol.org to pick up the files
initially (thanks Bo).
Any comments appreciated, maybe there's a way to shrink that parse with
something like thru [ {src="} | {img="} ].
cheers,
john
REBOL [
]
source-dir: %/home/public/html/
all-files: recursive-files source-dir
html-files: copy []
foreach file all-files [ if find to-string file ".htm" [ insert html-files file
] ]
; Firsly the html files
foreach file html-files [
print file
file-contents: read file
parse file-contents [
any [
thru {src="}
mark:
copy file-name
:mark
to {"}
(if string? file-name [ change mark lowercase file-name ])
]
any [
thru {img="}
mark:
copy file-name
:mark
to {"}
(if string? file-name [ change mark lowercase file-name ])
]
]
write file file-contents
]
; now the rest
foreach file all-files [
print file
if not strict-equal? to-string file lowercase to-string file [
rename file to-file lowercase to-string file
]
]