0

This is my continuing attempt to build a filename format verification batch routine (batch variable exclamation points used in dir | findstr) Here's where I'm at:

echo off
REM Ensure filenames are of the format ALBUM - TITLE
chcp 1254>nul
setlocal DisableDelayedExpansion
set /p CUTOFFDATE=Enter the Date of the Last Cleanup (yyyymmdd):
for /r "\\kodi-pc\g\itunes\iTunes Media\Podcasts\American Civil War\" %%i in (*.mp3) do (
set "FILENAME=%%~nxi"
set "FILEDATE=%%~ti"
call set "TITLE=%%FILENAME:* - = - %%"
call:SETALBUM
call set "FILEDATE=%%FILEDATE:~6,4%%%%FILEDATE:~0,2%%%%FILEDATE:~3,2%%"
setlocal EnableDelayedExpansion
if !FILEDATE! GTR !CUTOFFDATE! (
    echo ~ALBUM~TITLE~FILENAME~ ~!ALBUM!~!TITLE!~!FILENAME!
    )
endlocal
)
pause
exit /b

:SETALBUM
call set "ALBUM=%%FILENAME:%TITLE%=%%"
exit /b

Works great except where folder names contain non-ASCII characters (», ’, etc.). My effort has been to recognize bangs (!) but that accomplished I now have these other problems.

The foldername 'American Civil War' is merely a sample placeholder for this forum. In reality I loop through many hundreds of foldernames.

Thx.

RKO
  • 161
  • 10
  • 1
    This line of code is not doing what you think it does. `if %%FILEDATE%% GTR %%CUTOFFDATE%%`. Those variables will never expand to values. – Squashman Mar 24 '20 at 17:39
  • Thx you're right. It was a leftover from earlier attempts. I'll have to remember how I did that. Suggestions are welcome. – RKO Mar 24 '20 at 18:00
  • Fixed the date checking lines per squashman – RKO Mar 24 '20 at 18:18
  • 1
    Answer was found here: https://stackoverflow.com/questions/18813495 use chcp 65001 Thx all – RKO Mar 24 '20 at 23:12

0 Answers0