I've redid the script to get all files in a folder/subfolders that are > 730 days and move to another folder(archive) however I'm missing something. The script runs, and I don't get any errors but no move is taking place. Any suggestions?
See code below
Dim SOURCE, TARGET
SOURCE = "C:\Documents and Settings\barnesl.CHIPLEY\Exercise starts\VB.NET"
TARGET = "C:\Documents and Settings\barnesl.CHIPLEY\archives\"
Dim fso, SourceObj, TargetObj, fileObj
Set fso = CreateObject("Scripting.FileSystemObject")
Set SourceObj = fso.GetFolder(SOURCE)
set targetobj = fso.GetFolder(target)
sub recurse( byref sourceobj)
set subfolders = sourceobj.subfolders
set fileobj = sourceobj.files
For Each fileobj in files
If DateDiff("d", fileobj.DateLastModified, Now) > 730 Then
fileobj.Move (Targetobj)
End If
Next
for each folder in subfolders
recurse folder
next
set subfolders = nothing
set fileobj = nothing
end sub