Jump to content

Convert all filename to lowercase


Dieuz
 Share

Recommended Posts

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
Link to comment
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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...