• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 419
  • Last Modified:

Need script to copy & replace a backup file on Windows PC to Windows server.

I need a script to copy a backup file from a Windows XP computer to a Windows server 2008 by using the task manager on the XP computer....rough mapping would be...

\\UserPC\deptfile\backup\backup.bak

to

\\server\data\dept\backup\

The XP computer is on a domain with access to the server.

Also need the script to overwrite the previously backed up file on the server. Thx.
0
Wilmette
Asked:
Wilmette
1 Solution
 
jawa29Commented:
Hi Wilmette

How's this?

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\UserPC\deptfile\backup\backup.bak" , "\\server\data\dept\backup\", OverwriteExisting

Jawa29

0
 
brd24gorCommented:
Alternatively, you could have your task run this line of code without needing a script:
echo F | xcopy /y /f /i \\UserPC\deptfile\backup\backup.bak \\server\data\dept\backup\backup.bak

Open in new window

0
 
Bill PrewCommented:
Save this as a BAT file, and then create a scheduled task in Windows task scheduler to run it at the desired time and frequency.

@echo off
set CopyFile=\\UserPC\deptfile\backup\backup.bak
set DestDir=\\server\data\dept\backup
if not exist "%DestDir%\" md "%DestDir%\"
xcopy /y "%CopyFile%" "%ToDir%\"

Open in new window

~bp
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
FlippCommented:
If you need a good solid tool for this type of oPeration, then you can try Robocopy from the 2003 Resource Kit.
0
 
WilmetteAuthor Commented:
Thanks for the replies. I forgot to explain that the script will be run daily in MS Task Manager.
0
 
WilmetteAuthor Commented:
I should say...Task Scheduler not Task Manager...ooops
0
 
FlippCommented:
You can use either solution by creating an executable scripted file and then calling that file from the MS Scheduled Task.

Do you need the code for the function you requested above?
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now