Case Sensitivity in Linux Server


R

Roy Schestowitz

A relative of mine compiled an extensive (~3,000 files) network of
genealogical Web pages. The problem is: he built all of this on a Windows
machine and made /many/ uppercase-lowercase inconsistencies. Due to the
large bulk of files, changing this by hand would be very impractical.

Is there a way I could graft the files onto a Linux server and get them to
work properly? Are there special settings/options for the server (maybe
..htaccess)? Are there tools that scan the files and convert them in some
way (also within) to make them all lower- or upper-case?

I would greatly appreciate your help on this.

Roy
 
Ad

Advertisements

T

Toby Inkster

Roy said:
Is there a way I could graft the files onto a Linux server and get them
to work properly?

Assuming an Apache server, try mod_speling (sic).
 
R

Roy Schestowitz

Toby said:
Assuming an Apache server, try mod_speling (sic).

As I am not the sysadmin of that Web server, I don't know if this can
provide a solution. I looked up your good suggestion and found that the
CheckSpelling directive needs to be changed -- something which I cannot do
myself. Perhaps I am missing something...

Is there a script that renames all directories and files to pure lowercase
and then changes all links in the files appropriately?

Roy
 
M

Mitja

CheckSpelling directive needs to be changed -- something which I cannot
do myself. Perhaps I am missing something...
nope, that's ok. Toby assumed you had sufficient privileges to do it.
Is there a script that renames all directories and files to pure
lowercase and then changes all links in the files appropriately?

That's pretty basic so I doubt there's a script for it. To rename the
files to lowercase (in bash):
for $fn in `find -name '*.html' | sort -r`; do mv $fn `echo $fn | tr
[:upper:] [:lower:]`; done

I sort the files in reverse order before processing here so ./Foo/Bar gets
renamed before the folder Foo becomes foo and ./Foo/Bar starts pointing
nowhere.

To do the magic inside the files:
perl -p -i -e 's/(href=".*?")/\L$1/' `find -name '*.html'`

Disclaimer: tested VERY briefly, but should work.
Feel free to ask if you need any modifications/explanations.

Mitja
 
T

Toby Inkster

Mitja said:
Roy Schestowitz said:
Is there a script that renames all directories and files to pure
lowercase and then changes all links in the files appropriately?

That's pretty basic so I doubt there's a script for it. To rename the
files to lowercase (in bash):
for $fn in `find -name '*.html' | sort -r`; do mv $fn `echo $fn | tr
[:upper:] [:lower:]`; done

But that doesn't update the links. For that you'll probably want to do a
bit of Perl regexp stuff.
 
Ad

Advertisements

T

Toby Inkster

Roy said:
As I am not the sysadmin of that Web server,

So give the sysadmin some beer and get him to do it for you. This *always*
works.
I don't know if this can provide a solution. I looked up your good
suggestion and found that the CheckSpelling directive needs to be
changed -- something which I cannot do myself.

Not even in an .htaccess file?
 
L

Leif K-Brooks

Toby said:
Mitja said:
Roy Schestowitz said:
Is there a script that renames all directories and files to pure
lowercase and then changes all links in the files appropriately?

That's pretty basic so I doubt there's a script for it. To rename the
files to lowercase (in bash):
for $fn in `find -name '*.html' | sort -r`; do mv $fn `echo $fn | tr
[:upper:] [:lower:]`; done

But that doesn't update the links. For that you'll probably want to do a
bit of Perl regexp stuff.

Are you sure you read Mitja's whole post?
 
R

Roy Schestowitz

Mitja said:
CheckSpelling directive needs to be changed -- something which I cannot
do myself. Perhaps I am missing something...
nope, that's ok. Toby assumed you had sufficient privileges to do it.
Is there a script that renames all directories and files to pure
lowercase and then changes all links in the files appropriately?

That's pretty basic so I doubt there's a script for it. To rename the
files to lowercase (in bash):
for $fn in `find -name '*.html' | sort -r`; do mv $fn `echo $fn | tr
[:upper:] [:lower:]`; done

I sort the files in reverse order before processing here so ./Foo/Bar gets
renamed before the folder Foo becomes foo and ./Foo/Bar starts pointing
nowhere.

To do the magic inside the files:
perl -p -i -e 's/(href=".*?")/\L$1/' `find -name '*.html'`

Disclaimer: tested VERY briefly, but should work.
Feel free to ask if you need any modifications/explanations.

Mitja

I found some other solution in the mean time. It is very similar and I am
writing about it at the moment:

http://www.schestowitz.com/Software/Lowercase/

Roy
 
Ad

Advertisements

R

Roy Schestowitz

Toby said:
So give the sysadmin some beer and get him to do it for you. This *always*
works.


Not even in an .htaccess file?

Is that possible? I hope not, or else I spent hours in vain. *wink*

Roy
 
Ad

Advertisements


Top