Sign in to follow this  
Followers 0
Dieuz

Convert all filename to lowercase

4 posts in this topic

#1 ·  Posted (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 by Dieuz

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

That works like a charm!

Thanks alot Danny! ;)

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Spiff59

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0