Tuesday, January 11, 2022

Copy files based on file list document 按照文件清單複製檔案 抄送

 Consider of a scenario, partner's SFTP server is down for an hour . A lots of files failed to upload to them.  After comparing the file list of two company, a missing file list text file has been created.
Maybe 100 out of 1000 files are missing.

Hence, you are going to resend those missing files based on the file list.
Batch script below help to do the job in an easy way.

You may just copy all missing files to a new folder, then resend.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
@ECHO ON


SET FileList=C:\Users\XXX\MissingFiles.txt
::The folder that contains the files
SET Source=X:\AllFiles
::The folder that the files should be copied to
SET Destination=Y:\ToBeResend

 

FOR /F "USEBACKQ TOKENS=*" %%F IN ("%FileList%") DO XCOPY /F /Y "%Source%\%%~F" "%Destination%\"

GOTO :EOF

 

No comments:

Post a Comment

Migrating from Renpy to Godot

 Due to the limitation of renpy in rendering dynamic screen ,  due the the black border it gives in different UI scale resolution , finally ...