Sign in with
Sign up | Sign in
Your question

Windows 7 xcopy to terserver

Last response: in Windows 7
October 17, 2011 2:33:49 PM

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

copies files ok but copies all files not just new ones
October 17, 2011 7:10:12 PM

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

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