Dieuz Posted August 26, 2010 Share Posted August 26, 2010 (edited) Hi, I have a folder containing over 500 files. I would like to convert each of these filename to become lowercase. What would be the more efficient way to do it? Thanks! Edited August 26, 2010 by Dieuz Link to comment Share on other sites More sharing options...
Danny35d Posted August 26, 2010 Share Posted August 26, 2010 Try it:#include <File.au3> Local $FilePath = 'C:\Temp' $FileList = _FileListToArray($FilePath, '*', 1) If IsArray($FileList) Then For $x = 1 To $FileList[0] FileMove($FilePath & '\' & $FileList[$x], StringLower($FilePath & '\' & $FileList[$x]), 9) Next EndIf AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
Dieuz Posted August 26, 2010 Author Share Posted August 26, 2010 That works like a charm! Thanks alot Danny! Link to comment Share on other sites More sharing options...
Spiff59 Posted August 26, 2010 Share Posted August 26, 2010 (edited) I'm not sure how long and convoluted your pathnames are, or whether you want to mess with directory names, or how many times this line of code is going to be executed, but... I would think: FileMove($FilePath & '\' & $FileList[$x], StringLower($FilePath & '\' & $FileList[$x]), 9) ought to be: FileMove($FilePath & '\' & $FileList[$x], $FilePath & '\' & StringLower($FileList[$x]), 9) Edit: Actually, since you mentioned "efficient", this would likely be the best refinement of Danny's code: #include <File.au3> Local $DirPath = 'C:\Temp' $FileList = _FileListToArray($DirPath, '*', 1) If IsArray($FileList) Then $DirPath &= "\" For $x = 1 To $FileList[0] $FilePath = $DirPath & StringLower($FileList[$x]) FileMove($FilePath, $FilePath, 9) Next EndIf Edited August 27, 2010 by Spiff59 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now