Home

Roy Schestowitz

Windows Server to Unix Server

Moving from case-insensitive to case-sensitive

What is it used for?

The Linux filesystem behaves differently from that of Windows. For example, Linux treats index.htm and INDEX.htm as if they are separate files; Windows does not. This means that if a site was designated for a Windows platform or was tested under Windows, it would not necessarily work properly when put on a Linux server. This page provides an automatic approach to converting all files and directories to lower-case as well as all references to these files, e.g. links and images.

There are no guarantees that the code will work and you must use it at your own risk. Make back-ups at the start. There are some known flaws, but none appears critical.

The entire procedure relies on 3 scripts which were modified and glued together. Here are the sources of the scripts:

Here are the modified scripts which need to be saved as individual files in the same directory -- preferably the top level of the site requiring conversion.

  • global: responsible for applying code to all sub-directories
  • lc_content: responsible for changing links
  • lc_files_dirs: responsible for changing names of directories and files

Once these files have been saved to the appropriate location (let us say ~/my_site), change their permissions so that they become executable:

chmod 700 ~/my_site/global ~/my_site/lc_content ~/my_site/lc_files_dirs

To convert names of files and directories:

global ~/my_site/lc_files_dirs -a

Run this several times to correspond with the maximal depth of (sub-)directories. Remember that directory names change as the scripts proceeds (you might have to think about this for a minute in order to realise it is so). Run the scripts above until warnings are no longer displayed.

When all files and directories have been renamed, change the 'intra-file' references to these:

~/my_site/lc_content

The site should now comprise pure-lowercase files and directories, hence it is acceptable by Linux servers.

Pitfalls

The above script converts all references to files so that they become strictly lowercase. Nonetheless, this assumes at most one link at each line.

If external links are referring to a site which is hosted on a Linux server and the address is a mixture of upper- and lower-case, then the link/s might break.


This page was last modified on March 23rd, 2005 Maintained by Roy Schestowitz