Solved

Logging in a batch script

Posted on 2008-10-27
3
301 Views
Last Modified: 2012-05-05
Hi, have added the following commands at the end of my batch script
Rem Store backup Script
net use e: /d


rem Store - 001
ping 10.10.10.2
net use e: \\10.10.10.2\2007 /user:admin password
f:
copy *.* d:\storedata\001\ /y


net use e: /d /y
date /t >>d:\storedata\backuplog.txt
time /t >>d:\storedata\backuplog.txt

end

Would it be possible to log how much data has copied or to log the size of folder after it has been copied? (d:\storedata\001)
0
Comment
Question by:Dan560
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 250 total points
ID: 22812074

Try:



DIR d:\storedata\001\ >>d:\storedata\backuplog.txt

Open in new window

0
 
LVL 43

Assisted Solution

by:Steve Knight
Steve Knight earned 250 total points
ID: 22812151
If you just want the total of the files then do

dir D:\storedata\001 /s | find "Dir(s)" >>d:\storedata\backuplog.txt

Depends upon your needs but easy enough to add a bit more logging if you want with some echo statements etc:

Steve

@echo off
Rem Store backup Script
echo %date% %time% Backup started >> d:\storedata\backuplog.txt
echo ... %date% %time% Removing old drive mapping  >> d:\storedata\backuplog.txt
net use e: /d  >> d:\storedata\backuplog.txt 2>>&1
ping 10.10.10.2
echo ... %date% %time% Mapping drive >> d:\storedata\backuplog.txt
net use e: \\10.10.10.2\2007 /user:admin password  >> d:\storedata\backuplog.txt 2>>&1
f:
echo ... %date% %time% Starting copy >> d:\storedata\backuplog.txt
copy *.* d:\storedata\001\ /y  >> d:\storedata\backuplog.txt 2>>&1
net use e: /d /y
dir D:\storedata\001 /s | find "Dir(s)" >>d:\storedata\backuplog.txt
echo %date% %time% Backup completed >> d:\storedata\backuplog.txt

0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 22812164
To make it look less busy add

set log=d:\storedata\backuplog.txt

at the beginning and replace all the d:\storedata\backuplog.txt entries with %log%

Steve

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

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

13 Experts available now in Live!

Get 1:1 Help Now