Skip to content

Instantly share code, notes, and snippets.

@examinedliving
Created September 3, 2013 23:35
Show Gist options
  • Save examinedliving/6431015 to your computer and use it in GitHub Desktop.
Save examinedliving/6431015 to your computer and use it in GitHub Desktop.
Renames a bunch of files that have an underscore as the first character to the name without the underscore. The extension and first character are changeable - also could be multiple first characters.
setlocal enabledelayedexpansion
for /r %%i in (*.html) do (
set a=%%~nxi
set b=!a:~0,1!
if /i NOT "!b!"=="_ " (
del "%%i"
) else (
set c=%%~nxi
set d=!c:~1,1000!
rename %%i !d!
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment