Solved

Parse Robocopy text log

Posted on 2014-04-17
4
1,132 Views
Last Modified: 2014-04-26
Team
Looking or a way to parse Robocop log into a linear line of data so I can import into database. Did not see a way in robocapy to customize log to do so. We would like to parse the following.
 
Also if there is a way to get Robocopy to out in a linear manner so it can be imported in database. Surprised did not see in any forums.

Started : Thu Apr 17 01:17:30 2014
Source : \\servera\project1\
Dest : \\serverb\project1\
Dirs :         7         7         0         0         0         0
Files :        63        63         0         0         0         0
Bytes :   998.0 k   998.0 k         0         0         0         0
Speed :             838653 Bytes/sec.
Speed :              54.432 MegaBytes/min.
Ended : Thu Apr 17 01:17:31 2014

Need output to look like this so we can import to database. Coma delimited.

Started,Source,Dest,Dirs,files,bytes,speed,ended

Thu Apr 17 01:17:30 2014, \\servera\project1\, \\serverb\project1\,7,63,998.0, 838653, 54.432, Thu Apr 17 01:17:31 2014


Example of file. Typically we would have about 500 rows of them have 2 samples they are all the same row size. We are not displaying files or directories to keep log consistent in row size. We run each share as an individual site so it produces multiple robocpy outputs.


-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Thu Apr 17 01:17:30 2014

   Source : \\servera\project1\
     Dest : \\serverb\project1\

    Files : *.*
          
  Options : *.* /NC /NDL /NFL /TEE /S /E /COPYALL /DCOPY:T /PURGE /MIR /R:1 /W:1

------------------------------------------------------------------------------


------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         7         7         0         0         0         0
   Files :        63        63         0         0         0         0
   Bytes :   998.0 k   998.0 k         0         0         0         0
   Times :   0:00:01   0:00:00                       0:00:00   0:00:00


   Speed :             838653 Bytes/sec.
   Speed :              54.432 MegaBytes/min.

   Ended : Thu Apr 17 01:17:31 2014

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Thu Apr 17 01:17:32 2014

   Source : \\serverd\project1\
     Dest : \\servere\project1\

    Files : *.*
          
  Options : *.* /NC /NDL /NFL /TEE /S /E /COPYALL /DCOPY:T /PURGE /MIR /R:1 /W:1

------------------------------------------------------------------------------


------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         7         7         0         0         0         0
   Files :        63        63         0         0         0         0
   Bytes :   998.0 k   998.0 k         0         0         0         0
   Times :   0:00:01   0:00:01                       0:00:00   0:00:00


   Speed :             1104964 Bytes/sec.
   Speed :              57.504 MegaBytes/min.

   Ended : Thu Apr 17 01:17:33 2014
0
Comment
Question by:williamfl
  • 3
4 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 40007783
Give this a try and let me know how you make out.
I think I've covered your requirements and it seems to work against the sample you've posted.

Lines 2 & 3 are the ones you may want to adjust to reflect your actual log file name and location, as well as your actual output CSV.  Let me know if you need assistance locating and modifying that.

Hope this helps.
rctest.vbs
0
 

Author Comment

by:williamfl
ID: 40009657
The only things we wish we haded to list was the
Skipped   Mismatch  and Failed for Dirs and Files so we can scan for errors quicker also.  
We are looking at modify you code unless you think you can be update quickly to get the other data points.


This script is still really great. Helps when working with thousands of robocopies scripts.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 40009687
I don't have access to a log with that info, at least not until next week.
If it's in the list of items, like the others, you may can just add them to the DesiredElements array (follow the same format - the entire line up until the colon (:))
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 40025038
Glad I could help.
Thanks for the grade! :^)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question