Quantcast
Viewing all articles
Browse latest Browse all 9217

Batch file output redirection to a text file; not complete

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"or @echo !_i:~-18,-4!, without redirection; will this function properly. Using the 'echo redirection' only redirects 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?


Viewing all articles
Browse latest Browse all 9217

Trending Articles