search given set of file names.* in all sub directories and copy to another directory

前端 未结 2 1651
孤城傲影
孤城傲影 2021-01-26 04:42

I need extension to this question: search given set of files and copy to another directory

There is a given set of file names in a needToFind.txt file such as:

m

2条回答
  •  时光取名叫无心
    2021-01-26 04:49

    @echo off
    cd "\MyImageFolder"
    for /f "usebackq eol=: delims=" %%F in ("needToFind.txt") do copy "%%~F.*" "\anotherFolder"
    

    If the provided file names already have extensions, and you want to ignore the extensions, you can use

    @echo off
    cd "\MyImageFolder"
    for /f "usebackq eol=: delims=" %%F in ("needToFind.txt") do copy "%%~nF.*" "\anotherFolder"
    

提交回复
热议问题