J
jatman
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
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