?
Solved

Logging in a batch script

Posted on 2008-10-27
3
Medium Priority
?
312 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
[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
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 1000 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 1000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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