[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 435
  • Last Modified:

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?
0
kenny_klbn
Asked:
kenny_klbn
  • 3
1 Solution
 
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
 
merowingerCommented:
Need further information?
0
 
kenny_klbnAuthor Commented:
Hi merowinger,
sorry for late reply. Im still testing the script. will feedback once done.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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