Technical article 119046

I have turned on "mixedcasesupport" but how do I convert all my files to lower case

OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6

Written · Last revised

Problem

AFPS will allow the same file to be written to the file share with mixed
case support.  For example, you can have the file:
aaa
AAA
aAa
aAA
... etc

To fix the filenames to only be in lowercase the mixedcasesupport flag needs to be set.

This will ensure that any file being written from a Windows client will always be the same case.

If you turn this option on but don't convert the filenames to lower case you will not be able to see the uppercase files or folders. You may experience Microsoft Office problem writing files in uppercase complaining that .tmp "temporary" file is inaccessible as Microsoft Office will try to rename the existing file first.

Solution

For AFPS 3.5.2n:
---------------
This is done by changing the following line in the file "lanman.ini" in
/usr/net/servers/lanman:
[ fsi ]
mixedcasesupport=no
You may wish to add:
uniquesuffixlength=1
So rather than using three chars as the unique separator for long
filenames use the NT standard of 1 char.  For Example, Progra~1 instead
of Prog~efr.  However, if you create a "Test Folder" it becomes:
TESTFO~X instead of TESTFO~1
For AFPS 4.0.2:
--------------
REGCONFIG=/usr/net/servers/lanman/bin/regconfig
PARAM=MixedCaseSupport
FSPARAMS=SYSTEM/CurrentControlSet/Services/AdvancedServer/FileServiceParameters
        echo "$PARAM before setting:"
        $REGCONFIG -v $FSPARAMS $PARAM | cut -d ":" -f 3
        $REGCONFIG $FSPARAMS $PARAM REG_DWORD 0
        echo "$PARAM after setting:"
        $REGCONFIG -v $FSPARAMS $PARAM | cut -d ":" -f 3
        echo "Press RETURN"
        read CONT
Making the Change:
-----------------
Then stop and start AFPS using the commands:
# net stop server
# net start server
Changing Existing Files:
-----------------------
To convert all your existing files and folders from upper to lower case
run the script below.

Note, this will create a file in your $HOME/tmp listing. Any conflicts and the file.<pid> will show the history of the commands run.

There, are many ways of doing this, but this script is provided as an example.

ONLY RUN THIS SCRIPT ON DIRECTORIES THAT ARE SHARED OUT BY AFPS.

ie. run "net share" to confirm.

DO NOT RUN DIRECTLY UNDER THE "/" (root) DIRECTORY.

#!/bin/ksh
# ident   "@(#) chcase"
# comment "@(#) Change The Case of Folders Below Current Location"
#
# Usage: $0
#
# Is this an AFPS Server ?
if [ ! -f /usr/net/servers/lanman/lanman.ini ]; then
        echo "This is not an AFPS Server !"
        exit 1
fi
#
# Double Check what you are about to do
#
if [ $# -lt 1 ]; then
        echo "\nDo you wish to continue with moving all files to lower case from
here onwards !\n"
        pwd
        echo "\n(Y/N) [Default=y] ? "
        read CONT
        if [ "${CONT}" = "" ]; then
                CONT="Y"
        fi
        if [ "${CONT}" = "N" ] || [ "${CONT}" = "n" ]; then
                exit 0
        fi
else
        if [ $1 != "/SURE" ]; then
                echo "Usage : $0 /SURE"
                exit 1
        fi
fi
#
# From this Directory Downwards
#
DIR='.'
#
# Create a File for any problems
#
if [ ! ${HOME}/tmp ]; then
        mkdir -p ${HOME}/tmp
fi
rm -f ${HOME}/tmp/probs
#
# Use -depth so Directories are at the end
#
find "${DIR}"  -print -depth > ${HOME}/tmp/file.$$
cat ${HOME}/tmp/file.$$ | while read i
do
        #
        # This is the last file in the list
        #
        if [ "${i}" = "." ]; then
                break
        fi
        #
        # Find the File Name at the End of the Rainbow
        #
        A=0
        BREAKOUT=0
        LASTFILE=""
        DIRPATH=""
        BUILDUP=""
        while [ "${BREAKOUT}" = 0 ] ;
        do
                # set -xv
                NEW=`expr $A + 1`
                A=${NEW}
                FILE=`echo "${i}" | cut -d "/" -f "${A}"`
                #
                # As we cut the file from the path add it to the buildup
                # then when we reach the end we'll have a null
                #
                if [ "${FILE}" != "" ]; then
                        DIRPATH="${BUILDUP}${LASTFILE}"
                        BUILDUP="${DIRPATH}"
                        #
                        # Don't put a leading slash at the front of the path
                        #
                        if [ "${FILE}" != "." ]; then
                                LASTFILE="/${FILE}"
                        else
                                LASTFILE="${FILE}"
                        fi
                else
                        #
                        # Right, we now know the file so we'll rename it
                        # to lower case
                        #
                        FILE="${LASTFILE}"
                        newname=`echo "${FILE}" | tr '[A-Z]' '[a-z]'`
                        #
                        # Do Nothing if the file is already in lower case
                        #
                        if [ "${FILE}" != "${newname}" ]; then
                           #
                           # Check that there already isn't an lower case file
                           #
                           if [ ! -e "${BUILDUP}${newname}" ]; then
                                if [ "${FILE}" != "/UAP" ] && [ "${FILE}" !=
"/PRINT" ]; then
                                        echo "mv ${BUILDUP}${FILE}
${BUILDUP}${newname}"
                                        mv "${BUILDUP}${FILE}"
"${BUILDUP}${newname}"
                                fi
                           else
                                #
                                # Check that this process hasn't been run
already
                                #
                                if [ ! -e "${BUILDUP}${newname}.upper" ]; then
                                        echo "mv ${BUILDUP}${FILE}
${BUILDUP}${newname}.upper"
                                        mv "${BUILDUP}${FILE}"
"${BUILDUP}${newname}.upper" >> ${HOME}/tmp/list.$$
                                else
                                        echo "CAN NOT RENAME ${BUILDUP}${FILE}
to ${BUILDUP}${newname}.upper" >> ${HOME}/tmp/probs
                                fi
                           fi
                        fi
                        LASTFILE=""
                        DIRPATH=""
                        BUILDUP=""
                        BREAKOUT=1
                fi
        done
done

See also

TA118010, "Where can I find the differences between the "lanman.ini" file, used to configure my AFPS 3.5.2n server, and the Registry Keys used by AFPS 4.0.2?"

From the Xinuos technical article database, record 119046. Reproduced with permission. The original is at www.sco.com/ta/119046, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.