Solved

Parse Robocopy text log

Posted on 2014-04-17
4
1,012 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now