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

前端 未结 2 1630
孤城傲影
孤城傲影 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"
    
    0 讨论(0)
  • 2021-01-26 05:02
    @echo off
    cd "\MyImageFolder"
    for /F "usebackq delims=" %%a in ("needToFind.txt") do (
       for /R %%b in ("%%~Na.*") do copy "%%b" "\anotherFolder"
    )
    
    0 讨论(0)
提交回复
热议问题