Solved

Parse Robocopy text log

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

18 Experts available now in Live!

Get 1:1 Help Now