user3328713
user3328713

Reputation: 1

Need to change Uppercase to lowercase using batch file

Right now I can use this with some success but I cant get it to work recursively? Any help would be awesome! I have been googling all day to find a solution and I havent found anything else that works.

for /f "Tokens=*" %%f in ('dir /l/b/a-d') do (rename "%%f" "%%f")

it has been suggested to do this but I've had no success.

for /f "Tokens=*" %%f in ('dir /l/b/a-d/s') do (rename "%%f" "%%f")

Upvotes: 0

Views: 863

Answers (2)

Mete S.
Mete S.

Reputation: 23

Open a Command Prompt. Go to the folder with the cd command (eg.: cd "path of your folder"). Open a powershell by typing: powershell. Then input this:

get-childitem -recurse | Where {-Not $_.PSIsContainer} | Rename-Item -NewName {$_.FullName.ToLower()}

Upvotes: 0

David Ruhmann
David Ruhmann

Reputation: 11367

The rename command only takes a file name as the second parameter.

C:\>rename /?
Renames a file or files.

RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.

Note that you cannot specify a new drive or path for your destination file.

Here are the corrected rename parameters

for /f "tokens=*" %%F in ('dir /l/b/a-d/s') do rename "%%~fF" "%%~nxF"

Upvotes: 1

Related Questions