miracle.clam
02-08-2012, 12:08 PM
Hi,
I need help with the code to move files from local folder to webdav. I am able to move files from one folder to another in the local machine(please see code below). But wondering how I can move to webdav. Any help is greatly appreciated.
Sub CommandButton1_Click()
Dim objFSO As FileSystemObject, objFolder As Folder, PathExists As Boolean
Dim objFile As File, strSourceFolder As String, strDestFolder As String
Dim x, Counter As Integer, Overwrite As String
Application.ScreenUpdating = False
Application.EnableEvents = False
strSourceFolder = "C:\Documents and Settings\hmattapa\Desktop\Jan_Prep\RAW"
strDestFolder1 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\LROC"
strDestFolder2 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Argentina"
strDestFolder3 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Canada"
strDestFolder4 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Mexico"
strDestFolder5 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Unit"
Set objFSO = New FileSystemObject
Set objFolder = objFSO.GetFolder(strSourceFolder)
Counter = 0
For Each objFile In objFolder.Files
If InStr(1, objFile.Name, "LROC") Then
objFile.Copy strDestFolder1 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Argentina") Then
objFile.Copy strDestFolder2 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Canada") Then
objFile.Copy strDestFolder3 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Mexico") Then
objFile.Copy strDestFolder4 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Unit") Then
objFile.Copy strDestFolder5 & "\" & objFile.Name
End If
Counter = Counter + 1
Next objFile
End Sub
I need help with the code to move files from local folder to webdav. I am able to move files from one folder to another in the local machine(please see code below). But wondering how I can move to webdav. Any help is greatly appreciated.
Sub CommandButton1_Click()
Dim objFSO As FileSystemObject, objFolder As Folder, PathExists As Boolean
Dim objFile As File, strSourceFolder As String, strDestFolder As String
Dim x, Counter As Integer, Overwrite As String
Application.ScreenUpdating = False
Application.EnableEvents = False
strSourceFolder = "C:\Documents and Settings\hmattapa\Desktop\Jan_Prep\RAW"
strDestFolder1 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\LROC"
strDestFolder2 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Argentina"
strDestFolder3 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Canada"
strDestFolder4 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Mexico"
strDestFolder5 = "C:\Documents and Settings\hmattapa\Desktop\Test_Move\Unit"
Set objFSO = New FileSystemObject
Set objFolder = objFSO.GetFolder(strSourceFolder)
Counter = 0
For Each objFile In objFolder.Files
If InStr(1, objFile.Name, "LROC") Then
objFile.Copy strDestFolder1 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Argentina") Then
objFile.Copy strDestFolder2 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Canada") Then
objFile.Copy strDestFolder3 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Mexico") Then
objFile.Copy strDestFolder4 & "\" & objFile.Name
End If
If InStr(1, objFile.Name, "Unit") Then
objFile.Copy strDestFolder5 & "\" & objFile.Name
End If
Counter = Counter + 1
Next objFile
End Sub