Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script for file copy 1

Status
Not open for further replies.

AlexIT

Technical User
Jul 27, 2001
802
US
I was trying to script a file save operation to create copies of a closed database on a periodic basis:

set tm=%tm::=-%
set dtt=%dt%%tm%
xcopy C:\folder\folder2\maindatabase.mdb z:\folder\folder\backup\"database-%dtt%-%tm%".bkp

I plan to schedule this for multiple backup copies.

What have I done wrong so far?

Thanks,
Alex
 
try this:
t = DatePart("h", time) & DatePart("n", time) & DatePart("s", time)
d = DatePart("m", date) & DatePart("d", date) & DatePart("yyyy", date)

srcFile = "vpnPO.txt"
desFile = "vpnPO_"&t&"_"&d&".txt"
Dim oFSO, getFile
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.CopyFile "c:\temp\"&srcFile,"c:\temp\"&desFile, True
Set oFSO = Nothing
 
That does it! I was trying a couple differnt ways but THAT worked...thanks.

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top