windows xp xcopy

hi experts,

The user PC is 192.168.1.2
The user share folder is c:\share

The remote backup PC is 192.168.1.9
The backup folders are
c:\backup\week1
c:\backup\week2
c:\backup\week3
c:\backup\week4

How do i script xcopy to schedule a backup of c:\share, once a week to folders like week1, week2, week3, week4 and week5 and overwrite the contents in each folder once a month?
kenny_klbnAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AnilKumarSharmaCommented:
User scheduler application to call the batch file that contain your xcopy command and logic etc.

0
merowingerCommented:
better way would be to create 4 backup jobs which are scheduled on you specific time and execute the copyjob to the specific week

Scheduled Task 1:
xcopy C:\share \\192.168.1.9\c$\backup\week1 /S /E /Y

Scheduled Task 2:
xcopy C:\share \\192.168.1.9\c$\backup\week2 /S /E /Y

Scheduled Task 3:
xcopy C:\share \\192.168.1.9\c$\backup\week3 /S /E /Y

Scheduled Task 4:
xcopy C:\share \\192.168.1.9\c$\backup\week4 /S /E /Y
If you want a script anyway whihc is executed once per week with one scheduled task, then check the code below>
0
merowingerCommented:
set objShell = CreateObject("Wscript.Shell")

On Error Resume Next
strLastWeek = objShell.RegRead ("HKLM\Software\MyCopyJob\LastWeek")
wscript.echo strLastWeek
select case(strLastWeek)

Case "Week1"
      objShell.Run "xcopy C:\share \\192.168.1.9\c$\backup\week1 /S /E /Y",0,true
      objShell.RegWrite "HKLM\Software\MyCopyJob\LastWeek","Week2","REG_SZ"
case "Week2"
      objShell.Run "xcopy C:\share \\192.168.1.9\c$\backup\week2 /S /E /Y",0,true
      objShell.RegWrite "HKLM\Software\MyCopyJob\LastWeek","Week3","REG_SZ"
Case "Week3"
      objShell.Run "xcopy C:\share \\192.168.1.9\c$\backup\week3 /S /E /Y",0,true
      objShell.RegWrite "HKLM\Software\MyCopyJob\LastWeek","Week4","REG_SZ"
Case "Week4"
      objShell.Run "xcopy C:\share \\192.168.1.9\c$\backup\week4 /S /E /Y",0,true
      objShell.RegWrite "HKLM\Software\MyCopyJob\LastWeek","Week1","REG_SZ"
Case Else
      'Not executed yet starting with week 1
      objShell.Run "xcopy C:\share \\192.168.1.9\c$\backup\week1 /S /E /Y",0,true
      objShell.RegWrite "HKLM\Software\MyCopyJob\LastWeek","Week1","REG_SZ"
End Select
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
merowingerCommented:
Need further information?
0
kenny_klbnAuthor Commented:
Hi merowinger,
sorry for late reply. Im still testing the script. will feedback once done.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.