MS OS - Microsoft Forum to Usenet Gateway Header Right
Navbar Left Navbar Right


i am using the following batch file, that works for the basic back up on XP, SP2 cd C:\Operations\Forms (source folder) rasdial.exe vpn username passwd (establish VPN) echo %date%, %time%



Reply
Old 07-16-2008, 03:06 AM   #1
jatman
Guest
 
Posts: n/a
Default Batch file to create report.txt file for xcopy

i am using the following batch file, that works for the basic back up on XP,
SP2

cd C:\Operations\Forms (source folder)
rasdial.exe vpn username passwd (establish VPN)
echo %date%, %time% VPN Established > Report.txt (records date, time of VPN
connection)
set folder=%date:~0,2% (sets the folder name to the day of the week, Mo, Tu,
We, ... to be used on the destination drive)
net use "\\...\" (maps the drive)
xcopy c: \\server\pll065\%folder% /s /e /h /D (copies, source to destination.)
rasdial.exe test /disconnect (disconnects VPN)
echo %date%, %time% VPN Disconnected >> Report.txt (records VPN
disconnection in Report.txt file)
shutdown -r

all of this works pretty good, but there are two things that i cannot get it
to do:
first, the reports file writes over itself. How can i change it so that it
does not write over itself, but either adds to the existing file or creates a
new file with a date stamp in the title (either way will work, but prefer
just adding to the existing file.)

i tried the line:
echo %date%, %time%, VPN established > copy con report.txt
but this did not work. i also tired it without the ">" and no luck either.
(copy con is supposed to use the next available line, but i could be wrong.)

the second thing, i would like it to do is list any files that were updated
(if any.) the xcopy command shows the file names that are updated/backed up,
and at the end, how many were backed up. can this be sent to the same
report.txt?

ultimately, the report.txt should look like this:

date, time, vpn established (done)
file1.doc
file2.doc
file3.xls
3 files copied
date, time, vpn disconnected (done)

and the next time either it continues from there, or a new file. really
sounds easy, but i cannot get the last two things figured out.

any help is appreciated.

thank you,

jat

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-16-2008, 03:09 AM   #2
jatman
Guest
 
Posts: n/a
Default RE: Batch file to create report.txt file for xcopy

i can rename the file, at the end using:

for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "Report.txt"
%%f-%%e-%%d.txt

but if i update more than once a day (i get a duplicate file error, so i
thought i'd add the time as follows:

for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "Report.txt"
%%f-%%e-%%d,%time%.txt

but i get an error message indicating that the syntax of the command is
incorrect.

further, but still need help.

jat


"jatman" wrote:

> i am using the following batch file, that works for the basic back up on XP,
> SP2
>
> cd C:\Operations\Forms (source folder)
> rasdial.exe vpn username passwd (establish VPN)
> echo %date%, %time% VPN Established > Report.txt (records date, time of VPN
> connection)
> set folder=%date:~0,2% (sets the folder name to the day of the week, Mo, Tu,
> We, ... to be used on the destination drive)
> net use "\\...\" (maps the drive)
> xcopy c: \\server\pll065\%folder% /s /e /h /D (copies, source to destination.)
> rasdial.exe test /disconnect (disconnects VPN)
> echo %date%, %time% VPN Disconnected >> Report.txt (records VPN
> disconnection in Report.txt file)
> shutdown -r
>
> all of this works pretty good, but there are two things that i cannot get it
> to do:
> first, the reports file writes over itself. How can i change it so that it
> does not write over itself, but either adds to the existing file or creates a
> new file with a date stamp in the title (either way will work, but prefer
> just adding to the existing file.)
>
> i tried the line:
> echo %date%, %time%, VPN established > copy con report.txt
> but this did not work. i also tired it without the ">" and no luck either.
> (copy con is supposed to use the next available line, but i could be wrong.)
>
> the second thing, i would like it to do is list any files that were updated
> (if any.) the xcopy command shows the file names that are updated/backed up,
> and at the end, how many were backed up. can this be sent to the same
> report.txt?
>
> ultimately, the report.txt should look like this:
>
> date, time, vpn established (done)
> file1.doc
> file2.doc
> file3.xls
> 3 files copied
> date, time, vpn disconnected (done)
>
> and the next time either it continues from there, or a new file. really
> sounds easy, but i cannot get the last two things figured out.
>
> any help is appreciated.
>
> thank you,
>
> jat
>

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 07-16-2008, 05:42 AM   #3
AlmostBob
Guest
 
Posts: n/a
Default Re: Batch file to create report.txt file for xcopy

echo fred > fred text
overwrites

echo fred >> fred.txt
appends

--
Adaware http://www.lavasoft.de
spybot http://www.safer-networking.org
AVG free antivirus http://www.grisoft.com
Etrust/Vet/CA.online Antivirus scan
http://www3.ca.com/securityadvisor/virusinfo/scan.aspx
Panda online AntiVirus scan http://www.pandasoftware.com/ActiveScan/
Catalog of removal tools (1)
http://www.pandasoftware.com/download/utilities/
Catalog of removal tools (2)
http://www3.ca.com/securityadvisor/n...aspx?CID=40387
Blocking Unwanted Parasites with a Hosts file
http://mvps.org/winhelp2002/hosts.htm
links provided as a courtesy, read all instructions on the pages before use

Grateful thanks to the authors and webmasters
_

"jatman" <jatman@discussions.microsoft.com> wrote in message
news:E08092C1-029F-43F7-9227-5B67598A51FF@microsoft.com...
>i can rename the file, at the end using:
>
> for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "Report.txt"
> %%f-%%e-%%d.txt
>
> but if i update more than once a day (i get a duplicate file error, so i
> thought i'd add the time as follows:
>
> for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "Report.txt"
> %%f-%%e-%%d,%time%.txt
>
> but i get an error message indicating that the syntax of the command is
> incorrect.
>
> further, but still need help.
>
> jat
>
>
> "jatman" wrote:
>
>> i am using the following batch file, that works for the basic back up on
>> XP,
>> SP2
>>
>> cd C:\Operations\Forms (source folder)
>> rasdial.exe vpn username passwd (establish VPN)
>> echo %date%, %time% VPN Established > Report.txt (records date, time of
>> VPN
>> connection)
>> set folder=%date:~0,2% (sets the folder name to the day of the week, Mo,
>> Tu,
>> We, ... to be used on the destination drive)
>> net use "\\...\" (maps the drive)
>> xcopy c: \\server\pll065\%folder% /s /e /h /D (copies, source to
>> destination.)
>> rasdial.exe test /disconnect (disconnects VPN)
>> echo %date%, %time% VPN Disconnected >> Report.txt (records VPN
>> disconnection in Report.txt file)
>> shutdown -r
>>
>> all of this works pretty good, but there are two things that i cannot get
>> it
>> to do:
>> first, the reports file writes over itself. How can i change it so that
>> it
>> does not write over itself, but either adds to the existing file or
>> creates a
>> new file with a date stamp in the title (either way will work, but prefer
>> just adding to the existing file.)
>>
>> i tried the line:
>> echo %date%, %time%, VPN established > copy con report.txt
>> but this did not work. i also tired it without the ">" and no luck
>> either.
>> (copy con is supposed to use the next available line, but i could be
>> wrong.)
>>
>> the second thing, i would like it to do is list any files that were
>> updated
>> (if any.) the xcopy command shows the file names that are updated/backed
>> up,
>> and at the end, how many were backed up. can this be sent to the same
>> report.txt?
>>
>> ultimately, the report.txt should look like this:
>>
>> date, time, vpn established (done)
>> file1.doc
>> file2.doc
>> file3.xls
>> 3 files copied
>> date, time, vpn disconnected (done)
>>
>> and the next time either it continues from there, or a new file. really
>> sounds easy, but i cannot get the last two things figured out.
>>
>> any help is appreciated.
>>
>> thank you,
>>
>> jat
>>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a batch file? Eric Windows XP 4 04-28-2008 07:25 AM
Create Shared Folder Using Batch File or VBS NewsBot Microsoft News 0 03-26-2008 04:13 PM
xcopy /c >>file.log Jim T Windows 2003 Server 1 02-01-2008 04:37 PM
batch file calling exe file problem JPS Windows Vista Security 1 12-19-2007 08:18 PM
whats the command to create a new file using batch script kripesh Windows XP 2 09-24-2007 04:12 AM


All times are GMT -5. The time now is 02:51 PM.


Powered by vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Skin designed by CompletevB
Copyright © 2005-2008 Robert Schwarz, Sr. - All rights reserved - MS OS is an independent web site and is not affiliated with Microsoft Corporation.