Backing Up
Sorry Bob or who ever can give me advice,
How can I get it to make a folder called e.g. 04/03/2005 instead of having
a new directory where it includes the date in it. I was hoping to have the
date incorporated into the name so I know when it was backed up.
'---------------------------------------------------------------------------
Sub CopyFolder()
'---------------------------------------------------------------------------
Dim oFSO As Object
Dim sFolder As String
Dim oFolder As Object
Dim oFile As Object
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFolder = "I:\Backup\"
If Not oFSO.FolderExists(sFolder) Then
MkDir sFolder
End If
If Not oFSO.FolderExists(sFolder & Format(Date, "yyyy-mm-dd")) Then
MkDir sFolder & Format(Date, "yyyy-mm-dd")
End If
Set oFolder = oFSO.getfolder("C:\idsc\")
For Each oFile In oFolder.Files
If Int(oFile.DateLastModified) = Date Then
oFile.Copy sFolder & Format(Date, "yyyy-mm-dd") & "\" &
oFile.Name
End If
Next oFile
Set oFile = Nothing
Set oFolder = Nothing
Set oFSO = Nothing
End Sub
Thanks again
Greg
|