Advertisement
OgreVorbis

Strip first X chars from all files batch

Oct 7th, 2022
1,714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.65 KB | None | 0 0
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. color 0b
  4. set /p FOLDER_PATH=Drag the folder into here:
  5. :begin
  6. set /p X=How many chars do you want to chop off the beginning?
  7. set /p NEW_PREFIX=What would you like to put infront instead?
  8. pushd %FOLDER_PATH%
  9. for %%f in (*) do if %%f neq %~nx0 (
  10.     set "filename=%%~nf"
  11.     set "filename=!filename:~%X%!"
  12.     echo "%NEW_PREFIX%!filename!%%~xf"
  13. )
  14. popd
  15. echo.
  16. set /p YORN=Is that what you want(Y/N)?
  17. if /i "%YORN%" NEQ "Y" goto begin
  18. pushd %FOLDER_PATH%
  19. for %%f in (*) do if %%f neq %~nx0 (
  20.     set "filename=%%~nf"
  21.     set "filename=!filename:~%X%!"
  22.     ren "%%f" "%NEW_PREFIX%!filename!%%~xf"
  23. )
  24. popd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement