How to Convert All Files in a Windows Directory to Lower-Case Filenames (01/2009)
I frequently upload files from my digital camera to my Windows PC, then to a Linux server. It is helpful to change the casing of all filenames on the Windows PC to lower-case. This tends to prevent casing confusion when making thumbnails and editing HTML that links to the photos using Microsoft FrontPage. (The confusion comes about because Windows is case-insensitive but Linux is case-sensitive.)
The best solution I've found is a batch file by Frank-Peter Schultze, reproduced below. It works very well.
:: __________________________________________________________________ :: :: Batch File: Lowname.bat :: Author: Frank-Peter Schultze :: :: Updates: http://www.fpschultze.de/modules/smartfaq/faq.php?faqid=61 :: Enhancement Req. :: And Bug Reports: support@fpschultze.de :: :: Built/Tested On: Windows 98 SE, Windows NT 4.0, Windows 2000 :: Requirements: OS: Windows 95+, Windows NT4+ :: :: Purpose: Rename all file names in current directory to :: lower case file names. :: :: Syntax: No arguments required. :: :: Assumptions And :: Limitations: Lowname.bat could rename itself :: :: Last Update: 2001-10-04 :: __________________________________________________________________ :: @Echo Off If :'==%1' If Not %2'==' Goto %2 Set | Find "winbootdir=" > NUL If ErrorLevel 1 If Not %OS%'==Windows_NT' For %%C In (Echo Goto:End) Do %%C Windows 9x/NT/2K Batch File. If Not %1'==/?' Goto Begin Echo Renames all file names in current dir to lower case file names. Echo. Echo Lowname Goto End :Begin Echo Rename all file names in current dir to lower case file names? Echo. Echo Press [Ctrl-C] to cancel or: Pause If Not %OS%'==Windows_NT' Goto Win9x For /F "tokens=*" %%F In ('Dir /B /L') Do Move "%%F" "%%F" Goto End :Win9x LfnFor On For %%F In (*.*) Do Call %0 : Mc2lc "%%F" LfnFor Off If Exist %TEMP%.\Tmp.bat Del %TEMP%.\Tmp.bat For %%V In (Mix Low) Do Set %%Vcase= Goto End :Mc2lc (Mixcase-to-Lowcase) For %%F In (%3) Do Set Mixcase=%%F Ren "%Mixcase%" "Set Lowcase=%Mixcase%" Dir /B /L "Set Lowcase=%Mixcase%" > %TEMP%.\Tmp.bat Call %TEMP%.\Tmp.bat Ren "Set Lowcase=%Mixcase%" "%Lowcase%" :End
To use the text above as a batch file, just copy and paste it into a batch file with a name of your choosing on your Windows system, then run it. If copying and pasting the above text doesn't work well, you may have more luck opening this link in your browser and copying and pasting the contents.
I encourage all visitors here to visit Frank-Peter Schultze's website. Mr. Schultze's material is reproduced here only because websites come and go, and his website may disappear at some point in the future.
This web page is maintained by David T. Ashley. Local time on this server (at the time the page was served) is $today = date("g:i:s a \o\\n F j, Y."); echo $today; ?>