Question : please provide vb script to move 30days old files to new shared location along with subfolders

i need vb script to move 30days old  files to new shared location along with subfolders , reply with solution would be greatly appreciated

Answer : please provide vb script to move 30days old files to new shared location along with subfolders

ok... it was caused by a mismatch in case (e.g. C:\ABC <> C:\abc).
This should fix it.

sew
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
'-----------------------------------------------------------------------------------
' A recursive function to move all files (include sub-folders) from a source folder
' to a target folder, which are older than a certain days from today
'-----------------------------------------------------------------------------------
Const strSourceFolder = "\\machine A\direcotrypath"
Const strTargetFolder = "\\machine B\direcotrypath"
Const intDaysToKeep = 30
 
strCurrentFolder = strSourceFolder
 
Call MoveFolder(strCurrentFolder, intDaysToKeep)
msgbox "done"
 
 
Sub MoveFolder(strCurrentFolder, intDaysToKeep)
	Dim objFSO, objCurrentFolder
	Set objFSO = CreateObject("Scripting.FileSystemObject")
	Set objCurrentFolder = objFSO.GetFolder(strCurrentFolder)
 
	Dim objFile, objFolder
	For Each objFile In objCurrentFolder.Files
		If DateDiff("d", objFile.DateLastModified, Now) > intDaysToKeep Then
			strTargetPath = Replace(UCase(objFSO.GetParentFolderName(objFile)), UCase(strSourceFolder), strTargetFolder, 1)
 
			If Not objFSO.FolderExists(strTargetPath) Then objFSO.CreateFolder(strTargetPath)
			objFSO.MoveFile objFile, strTargetPath & "\" & objFSO.GetFileName(objFile)
		End If
	Next
 
	For Each objFolder In objCurrentFolder.subFolders
		Call MoveFolder(objFolder, intDaysToKeep)
	Next
End Sub
Random Solutions  
 
programming4us programming4us