Copy a list (txt) of files

后端 未结 5 1049
逝去的感伤
逝去的感伤 2020-11-29 22:27

I\'ve seen some scripts examples over SO, but none of them seems to provide examples of how to read filenames from a .txt list.

This example is good, so as to copy a

5条回答
  •  無奈伤痛
    2020-11-29 23:07

    This will do it:

    @echo off
    set src_folder=c:\batch
    set dst_folder=c:\batch\destination
    set file_list=c:\batch\file_list.txt
    
    if not exist "%dst_folder%" mkdir "%dst_folder%"
    
    for /f "delims=" %%f in (%file_list%) do (
        xcopy "%src_folder%\%%f" "%dst_folder%\"
    )
    

提交回复
热议问题