Solved

Parse Robocopy text log

Posted on 2014-04-17
4
1,183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

710 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