Solved

Logging in a batch script

Posted on 2008-10-27
3
300 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
Comment Utility

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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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