Hi all
Can someone please show me how i would copy several files with different names from a directory to another? the files are different names and types. Here's the code i have that will copy one file. thanks
Can someone please show me how i would copy several files with different names from a directory to another? the files are different names and types. Here's the code i have that will copy one file. thanks
Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const OverWriteExisting = True
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objDomain = getObject("LDAP://rootDse")
strDomain = objDomain.Get("dnsHostName")
strUser = WshNetwork.UserName
strHome = "\\sm-athena\Home\"
strHomeFolder = strHome & strUser
If Not objFSO.FolderExists(strHomeFolder) Then
objFSO.CreateFolder strHomeFolder
If Err.Number <> 0 Then
On Error GoTo 0
Wscript.Echo "Cannot create: " & strHomeFolder
End If
On Error GoTo 0
End If
strSource = "C:\Program Files\lotus\notes\data\Names.nsf"
strDest = strHomeFolder & "\"
objFSO.CopyFile strSource, strDest, OverWriteExisting
Set objFSO = Nothing