lcname: A Case-Changing Tool For Windows and DOS
Different operating systems have different methods of dealing with the capitalization of filenames. UNIX and Linux, for example, are case-sensitive: Story.txt, story.txt, and STORY.TXT would be three different files. Windows, on the other hand, is case-aware, but not case-sensitive. What's the difference? If you name a file Story.txt, Windows will keep track of that capitalization; as you move or copy the file, it will remember which letters were capitalized, and which weren't. But what happens if you try to move Story.txt into a folder which already contains a file named STORY.TXT? That's a no-no... Windows is going to ask you if you want to replace STORY.TXT with Story.txt. As far as Windows is concerned, STORY.TXT and Story.txt are the same filename.
So if you're using Windows, does it matter how you capitalize filenames? It does if you're going to be sharing files with Linux or UNIX users, or moving files to a Linux or UNIX server. Suppose you're building a website on a Windows workstation, and uploading your pages to a Linux server running Apache. On an IIS webserver, it wouldn't matter if you named your page Home.htm, and your HTML code contained links to (lowercase) home.htm. In the Windows world, the links would still work. But in the Linux world, you'd be screwed: your server would be looking for Home.htm... not home.htm. The links would be broken.
This utility, lcname.exe, was my way of dealing with this problem. It converts filenames to lowercase letters. I wrote it mainly because I was sick of dealing with a problem caused by my Macintosh. I used to create all of my graphics on a Mac, and I typically threw them onto a floppy disk to move to my Windows machine. My old version of Apple File Exchange, however, had a really annoying problem when I copied a file to a DOS floppy disk: it changed the filenames to all uppercase!
This is a command-line utility, and its use is pretty simple. Suppose you wanted to convert all the .htm files in c:\webfiles to lowercase. You'd use this command:
Not rocket science, is it?
This is a pretty simple tool: it can't convert to uppercase, title case, or any of that fancy stuff. I'm aware of some flaws in the current version:
- If you specified wildcards in your target, the program will list all of the files matching the wildcard and say that it is "processing" them, even if some of the files don't have any uppercase letters to begin with.
- If you specify a file which does not exist, the program will execute without telling you that the file doesn't exist. It won't actually do anything, but it won't specifically tell you that the file wasn't there, either.
- If an environment variable named "OS" has been created in either a DOS or a Win95 environment, the program will fail, generating an error stating that the OS cannot be identified. If such a variable has been created and assigned a value "Windows_NT" the program will probably fail in some sort of wierd ugly fashion. The moral: don't make a variable called OS if you are running those operating systems.
There are four files that lcname will automatically ignore: its temp file (lcls_qqq.tmp), and three files used by Apple File Exchange (desktop, finder.dat, and !openfol.der). I excluded these files just because I was tired of seeing messages saying that they could not be renamed every time I tried to convert the case of all filenames on a floppy disk that had been in my Macintosh. I couldn't think of any reason why anyone would NEED to convert those files, so I just hard coded the program to ignore them.
Like my other trashy utilities, lcname is freeware. It seems to work just fine on Windows 95, 98, and NT; I haven't tested it with Windows 2000 or XP, but I think it should work. I also haven't tested it with Windows ME, but why bother? Practically nothing works right on ME. Lcname was written in Borland C, and it has worked reliably for me, but be warned: I don't have the resources to thoroughly test on lots of different platforms. Use it cautiously: test it on some junk first before you start using it in mission-critical batch files. You can download lcname from the software archive here:
Program Description: A command-line utility for converting filenames to lowercase, written by the barely competent Bruce Sharp. This is Build 29, which is kind of scary when you realize it means he needed 29 tries to get something so simple to work right. The .zip file includes the .exe and the program documentation.