问题
Does anyone have any C# code that would help format the robocopy log file for easier upload to a database.
Sample log
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Thu Jul 07 12:00:12 2011
Source : C:\Sales\Out\
Dest : \\Marketing\Data\In\
Files : *.*
Options : *.* /COPY:DAT /MOV /R:1000000 /W:30
------------------------------------------------------------------------------
0 C:\Sales\In\
*EXTRA File 1.4 m 2011MarketingMaster.XLS
*EXTRA File 1.3 m 2011SalesOutput 01 .XLS
*EXTRA File 1.4 m 2011SalesOutput 02 .XLS
*EXTRA File 1.4 m 2011SalesOutput 03 .XLS
*EXTRA File 1.4 m 2011SalesOutput 04 .XLS
*EXTRA File 1.4 m 2011SalesOutput 05 .XLS
*EXTRA File 1.4 m 2011SalesOutput 06 .XLS
*EXTRA File 1.4 m 2011SalesOutput 07 .XLS
*EXTRA File 1.4 m 2011SalesOutput 08 .XLS
*EXTRA File 1.4 m 2011SalesOutput 09 .XLS
*EXTRA File 1.4 m 2011SalesOutput 10 .XLS
*EXTRA File 1.4 m 2011SalesOutput 11 .XLS
*EXTRA File 1.4 m 2011SalesOutput 12 .XLS
------------------------------------------------------------------------------
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 1 0 0 0
Files : 0 0 0 0 0 13
Bytes : 0 0 0 0 0 461.67 m
Times : 0:00:00 0:00:00 0:00:00 0:00:00
Ended : Thu Jul 07 12:00:12 2011
回答1:
If you're interested in the files only, using the /NJH (no job header) and /NJS (no job summary) switches might make your work a lot easier: MSDN: Robocopy
回答2:
Thank you J. Tihon
/njh Specifies that there is no job header.
/njs Specifies that there is no job summary.
来源:https://stackoverflow.com/questions/6608337/robocopy-log-file