Windows 7 xcopy to terserver

martyn_80

Distinguished
Oct 17, 2011
2
0
18,510
Hello,
using following bat file to back up windows 7 data to teraserver
net use a: \\harry\fred password > c:\log\errorlog
set /p response=<c:\log\errorlog
if not "%response:~22,12%"=="successfully" goto end
time /T > c:\log\fred.log
xcopy c:\fred a: /D /E /C /F /R /K /Y /Z > c:\log\fred.log
time /T > c:\log\fred.log
net use a: /delete > c:\log\errorlog
set /p response=<c:\log\errorlog
if not "%response:~15,12%"=="successfully" goto end
:end

copies files ok but copies all files not just new ones
 

Jurgens

Distinguished
Mar 10, 2011
169
0
18,690
Hi, use VBS Scripts. the following copy it and save it as a .vbs file


Dim sOriginFolder, sDestinationFolder, sFile, oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
sOriginFolder = "\\Server\Data"
sDestinationFolder = "C:\Backup"
For Each sFile In oFSO.GetFolder(sOriginFolder).Files
If Not oFSO.FileExists(sDestinationFolder & "\" & oFSO.GetFileName(sFile)) Then
oFSO.GetFile(sFile).Copy sDestinationFolder & "\" & oFSO.GetFileName(sFile),True
WScript.Echo "Copying : " & Chr(34) & oFSO.GetFileName(sFile) & Chr(34) & " to " & sDestinationFolder
End If
Next


the "sOriginFolder = "\\Server\Data"" is the files you want to backup and
"sDestinationFolder = "C:\Backup"" is where it must be backed up.

hope it helps