Examples:
Parent-Dir= ‘USA zip-code’, Sub-dir(s)= ‘yyyymmdd’
Example filename= 139_7_IPC1_NVR16-8580_20230101104640.jpg
There are six-hundred and ninety-nine files in the directory-tree that the regex within the For /F
loop (below) can see –only when I replace:
@echo !_i:~-18,-4!> "%cd%_A_A.txt"
with copy "%%i" "%cd%_A"
; will this function properly. Using the ‘echo’ part only outputs one line that complies with
set "_i=%%i"
@echo !_i:~-18,-4!> "%cd%_A_A.txt"
; which would output 20240203075520. There should be six-hundred and ninety-nine entries matching the file output when using copy "%%i" "%cd%_A"
.
@echo off
Setlocal EnableDelayedExpansion
FOR /F "delims=" %%i in ('dir /S /b %1*.jpg ^| findstr /r ^_2024[0-3][0-9]..0[0-7]') do (
set "_i=%%i"
@echo !_i:~-18,-4!> "%cd%_A_A.txt"
)
What have I broken?