运行.bat文件以上传图像文件,想知道哪些文件是新文件?


1

我已经.bat创建了一个文件,该文件会将新文件上传到公司的服务器。它运行良好,但是运行之后,我不知道哪些文件是新文件还是相同文件。批处理文件运行时,我可以看到它何时弹出为新文件,何时弹出相同的文件,但是我想创建一个日志文件,以显示新文件,不包括未上传的文件。

目前,这是我的.bat文件:

robocopy "C:\HUSAPOGDATA\Product_Library" "\\NOAMSNYW024.noam.heiway.net\NationalAccounts\Category Management\Space Planning Images\Product_Library" beer.mdb 

robocopy "C:\HUSAPOGDATA\Product_Library" "\\NOAMSNYW024.noam.heiway.net\NationalAccounts\Category Management\Space Planning Images\Product_Library" SMSB_Library.mdb 

robocopy "C:\Pog Images\Images\Beer" "\\NOAMSNYW024.noam.heiway.net\NationalAccounts\Category Management\Space Planning Images\Pog Images\Images\Beer" /E *.1 *.2 *.3 *.7 *.8 *.9 /MIR /S /V /NP /ZB

我使用以下命令记录数据,

fromlocal2network_productlibrary_new.bat > C:\Merch\log.txt

但我不希望所有命令输出,因为从成千上万个文件中获取的文件变得很大。有没有办法将新文件与日志文件中的旧文件分开?


3
查看robocopy日志记录选项Robocopy
DavidPostill

Answers:


2

要添加的示例语法: /LOG+:%Log%

来源(下): Robocopy /?

::
:: Logging Options :
::
                 /L :: List only - don't copy, timestamp or delete any files.
                 /X :: report all eXtra files, not just those selected.
                 /V :: produce Verbose output, showing skipped files.
                /TS :: include source file Time Stamps in the output.
                /FP :: include Full Pathname of files in the output.
             /BYTES :: Print sizes as bytes.

                /NS :: No Size - don't log file sizes.
                /NC :: No Class - don't log file classes.
               /NFL :: No File List - don't log file names.
               /NDL :: No Directory List - don't log directory names.

                /NP :: No Progress - don't display % copied.
               /ETA :: show Estimated Time of Arrival of copied files.

          /LOG:file :: output status to LOG file (overwrite existing log).
         /LOG+:file :: output status to LOG file (append to existing log).

       /UNILOG:file :: output status to LOG file as UNICODE (overwrite existing
log).
      /UNILOG+:file :: output status to LOG file as UNICODE (append to existing
log).

               /TEE :: output to console window, as well as the log file.

               /NJH :: No Job Header.
               /NJS :: No Job Summary.

           /UNICODE :: output status as UNICODE.

0

首先添加/ XO标志,以从输出中删除较旧的文件。

然后,为了使生成的RoboCopy日志中的输出进一步最小化,您可以添加以下标志:/ NDL / NS / NC。

注意:仅在测试命令并发现类信息(即旧文件)已从输出中删除后,才使用/ NC。使用/ L标志进行测试。此标志用于对命令执行“假设”。实际上没有文件被移动。

除了已经拥有的标记外,还应使用这四个标记。您可以删除的其他唯一输出(在文件名列表旁边)是作业标题和摘要。这成为您的选择。

不要犹豫,使用/ Tee选项创建日志,并在命令行中直观地看到实时结果。为此,您只需添加/ Tee / Log:%Log%

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.