Login | |
|
 |
Backing up all folder and subfolder recursively , i am ... - 10/9/2008 5:09:32 AM
|
|
 |
|
| |
bolobaboo
Posts: 3
Score: 0
Joined: 10/9/2008
Status: offline
|
Got following code and trying to twick, But unable to fix it. Any idea ? Option Explicit Backup "C:\Temp\tmp", "C:\Temp\restore" FUNCTION Backup (RepSource,RepDest) DIM objSource(1), objDest, objDestCompare, objFSO Set objFSO = CreateObject("Scripting.FileSystemObject") SET objSource(0)=objFSO.GetFolder(RepSource) IF NOT objFSO.FolderExists(RepDest) THEN objFSO.CreateFolder(RepDest) FOR EACH objFile IN objSource(0).Files objSource(1)=objFSO.BuildPath(RepSource,objFile.name) objDest=objFSO.BuildPath(RepDest,objFile.name) IF objFSO.FileExists(objDest) THEN SET objDestCompare=objFSO.GetFile(objDest) PROCESSFILE IF objDestCompare.Size<>objFile.Size Or objDestCompare.DateLastModified<>objFile.DateLastModified THEN objFile.Copy objDest,TRUE PROCESSFILE END IF ELSE objFile.Copy objDest,TRUE PROCESSFILE END IF NEXT SET objSource(0) = NOTHING SET objSource(1) = NOTHING SET objDest = NOTHING SET objDestCompare = NOTHING END FUNCTION FUNCTION PROCESSFILE objExplorer.Document.Body.InnerHTML = "Your backup is now being processed" & _ "<br><br>File " & intFileCount & " of " & strCountTheFiles & " has been copied.<br><br>" & _ "This may take several minutes to complete." intFileCount = intFileCount + 1 IF IsError(err) = TRUE THEN LogIt("Backed up file # " & intFileCount & " Had and error.") SET strLogFileName = NOTHING ELSE strLogFileName = objFile.Name LogIt("Backed up file # " & intFileCount & " " & RepSource & "\" & strLogFileName) SET strLogFileName = NOTHING END IF END FUNCTION
|
|
| |
|
|
|
 |
RE: Backing up all folder and subfolder recursively , i... - 10/12/2008 7:34:17 AM
|
|
 |
|
| |
Fredledingue
Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
|
Not sure but... Try calling the function with objFile as a variable like this: PROCESSFILE objFile Then change the header of the function like this: FUNCTION PROCESSFILE(MyFile) and replace "objFile" by "MyFile" inside the function. If doesn't work verify that objFile is a valid path. Eventualy use For Each File in objSource(0).Files Set objFile = objFSO.GetFile(File) ... Next HTH
_____________________________
Fred
|
|
| |
|
|
|
 |
RE: Backing up all folder and subfolder recursively , i... - 10/13/2008 7:51:46 AM
|
|
 |
|
| |
dm_4ever
Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
So you want someone to give you this? If so, you came to the wrong place....we help and don't write code for people not willing to invest time and effort in learning and doing a lot of the work for themselves.
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|