Search code examples
filebatch-filefile-iocopyxcopy

movy files that contain string or start with string


I'm looking to move .txt files from a folder containing many .txt files.

But only .txt files that start with string 'settlement-id' or contains 'settlement-id'.

Preferably a .bat file.


Solution

  • A way to do it :

    @echo off
    for /f "delims=" %%a in ('dir *.txt /b/a-d ^| find /i "settlement-id") do copy "%%a" "YOUR_PATH"