Jump to content

Recommended Posts

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
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

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
×
×
  • Create New...