I am trying to move files that are in a directory that are more then 10 min old to another directory. I have the code below but from time to time we are getting files with the same name in the source dir and destination dir and then throws an error that the files exsits. I just need to overright the one in the destination what do I need to add to do this? Also I would like to only move PDF files.
Set oFSO = CreateObject("Scripting.FileSystemObject")
sSource = "d:\testorg\"
sDestin = "d:\testnew\"
Set oFolder = oFSO.GetFolder(sSource)
For Each oFile in oFolder.Files
If DateDiff("n", oFile.DateLastModified, Now()) > 10 Then
oFSO.MoveFile oFile, sDestin