Backup

Poor man's backup

A simple system copying new or updated files recursively from a folder to another on another disk, creating folders if they don't exist and continuing on error.

File Name : backup.vbs
Requirement : none
Author : Jean-Luc Antoine
Submitted : 25/08/2004
Category : 4K
Option explicit
'Poor man's backup
Const Verbose=True
Dim fso,t
t=Now
Set fso=wscript.CreateObject("Scripting.FileSystemObject")
Traite "c:\","h:\svg_c"
Traite "d:\","h:\svg_d"
Traite "e:\","h:\svg_e"
Set fso=Nothing
If Verbose Then Wscript.Echo "Elapsed : " & cdate(Now-t)

Sub Traite(RepSource,RepDest)
	Dim r,f,S,D,z
	Set r=fso.GetFolder(RepSource)
	If Verbose Then WScript.Echo "Handling Folder " & RepDest
	If Not fso.FolderExists(RepDest) Then fso.CreateFolder(RepDest)
	For each f in r.Files
		S=fso.BuildPath(RepSource,f.name)
		D=fso.BuildPath(RepDest,f.name)
		If fso.FileExists(D) Then
			Set z=fso.GetFile(D)
			If z.Size<>f.Size Or z.DateLastModified<>f.DateLastModified Then
				If Verbose Then Wscript.Echo "Copying " & D
				f.Copy D,True
			End If
			Set z=Nothing
		Else
			If Verbose Then Wscript.Echo "Copying " & D
			On error resume next
			f.Copy D
			If Err.Number<>0 Then Wscript.echo "Error : " & S
			on Error Goto 0
		End If
	Next
	For each f in r.SubFolders
		S=fso.BuildPath(RepSource,f.name)
		D=fso.BuildPath(RepDest,f.name)
		Traite S,D
	Next
	Set r=Nothing
End Sub

Server Info
Remote Info
Compress

Batchs
BootSector
Droit
Accessoire GFA
On Now
Ecran plasma
Système d'exploitation
Son
Unités
Scripting
Multilingue
Site Web
Bruit et son
Architecture Google


4K
Color picker
TaskList
Backup files
Mini Port Scanner
Website To CHM
PixyDemo
Web password recovery
4KWebServer
Kill Popup
VBE decoder
Script Optimizer
Database Password Recovery
Class
Ini
EMail validator
Graphical Class
MP3 Info
Pinger Class
IP ranger class
SoftwareMetering
Path Validator
Time Stamper Class
LoggerCLS
HTA
Keyword Ranking
DOM Explorer
HTA-Notepad
PixyPortManager
Other
flashMessage
Kill Popup
VBE decoder (fixed)
Error Codes
Maze generator
Char counter
HTML To Word
ICQ Choose User
ScreenSaver Password decoder
Mp3Playlister - singleList
Long Filename To Short
Trace Math
Dump Hexa File
Self modifying script
Mp3Playlister - multiList
HTANoid
PixyWebServer
Python
Progress indication

©2002 Jean-Luc Antoine. All Rights Reserved. Scripts or any other material on this website may not be redistributed or put as part of ANY collection (script archives, CDs etc) without prior written permission. Permission granted to use and modify any of the scripts found on InterClasse.com