batch file - searching a filename having number in it from command prompt -


i want search zip files in directory based on pattern , have list out in .txt file e.g. having abc.zip , abc123.zip(123 can random numbers) code

for %%f in [fullpath]\abc*.zip @echo %%~ftf>> test.txt 

(enclosed in batch file) gives me output

[modified date][fullpath]abc.zip [modified date][fullpath]abc123.zip 

now twist here is, want list out abc123.zip , not abc.zip , cannot give pattern abc123*.zip, 123 can random numbers , not fixed. thanks

@echo off setlocal enabledelayedexpansion (   /f "delims=" %%i in ('dir /b /a-d abc*.zip ^|findstr /r [0-9]') ( set file=%%i       echo !file!   ) )>test.txt type test.txt | more exit /b 0 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -