Solved

Logging in a batch script

Posted on 2008-10-27
3
309 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
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 …

695 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