用于检索文档的Robocopy脚本

时间:2015-10-09 12:38:09

标签: batch-file robocopy

我有以下批处理文件连接到网络驱动器,并检索e:\cn_documents.csv文件中包含的文档列表到e:\data目录以及它找不到的任何文件它在doesnotexist.csv文件中。

批处理作业的问题是需要20个小时来检索200000个文档。我被告知Robocopy会更快。有人会有一个robocopy脚本,会做同样的事情吗?

@echo off
net use \\10.10.10.1\ipc$ /d
net use \\10.10.10.1\ipc$ /user:company\joebloggs Password1
SET destfolder=e:\data
SET DoesNotExistList="E:\DoesNotExist_CN.txt"

REM Reset the not exist list so it doesn't pile up from multiple runs.
ECHO The following Contract Note files were not found > %DoesNotExistList%

FOR /F "delims=" %%a IN (e:\cn_documents.csv) DO (
    REM Check if the file exists.
    IF EXIST "%%a" (
        REM It does exist, copy to the destination.
        COPY "%%a" "%destfolder%\%%~nxa"
    ) ELSE (
        REM It does not exist, note the file name.
        ECHO %%a>>%DoesNotExistList%
    )
)

0 个答案:

没有答案