Skip to content

Instantly share code, notes, and snippets.

@Korveld
Forked from kabilashgit/file-rename-lowercase.md
Created November 28, 2023 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Korveld/22ce61a4742c173f5281b986579c0474 to your computer and use it in GitHub Desktop.
Save Korveld/22ce61a4742c173f5281b986579c0474 to your computer and use it in GitHub Desktop.
rename all files to lower-case in windows

Rename all files in the directory to lowercase

open command line in that direct and run the following command

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

replace all subfolder files to lowercase

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

1 Replace "SPACES" with "DASH" in the folder

cmd /e:on /v:on /c "for %f in ("* *.jpg") do (set "n=%~nxf" & set "n=!n: =-!" & ren "%~ff" "!n!" )"
replace this ".jpg" (extension) and change the character in the bracket you want to replace "n=!n: =(-)!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment