Hi, CopyFolder and MoveFolder do support UNC paths, but you can get into errors with the trailing slashes, this should help overcome those.
Note that I have used CopyFolder, then DeleteFolder, instead of just MoveFolder, because MoveFolder doesn't support the True flag to overwrite:
'============
Dim objFSO
Set objFSO = CreateObject("Scripting.Fi
strSource = "\\d09790ring\c$\temp\move
' This ensures we can use the CopyFolder method, with True to overwrite,
' otherwise with the trailing slash, CopyFolder throws an error
If Right(strSource, 1) = "\" Then strSource = Left(strSource, Len(strSource) - 1)
strDest = "\\d09790ring\c$\temp\move
' This ensures that the CopyFolder method creates the target folder first, then copies
' the source *into* this target folder
If Right(strDest, 1) <> "\" Then strDest = strDest & "\"
If objFSO.FolderExists(strDes
objFSO.CreateFolder strDest
End If
If objFSO.FolderExists(strSou
objFSO.CopyFolder strSource, strDest, True
objFSO.DeleteFolder strSource, True
Else
MsgBox strSource & " does not exist."
End If
Set objFSO = Nothing
MsgBox "Done"
'============
Regards.
Rpb/
Main Topics
Browse All Topics





by: vico1Posted on 2007-08-07 at 19:30:49ID: 19650993
why don't you make make your script call a simple batch file?
Vico1