here's what i have so far. something's not working. it's not reading the source path correctly (and im sure it's right) is this not possible with .zip files?
Option Explicit
Sub Copy_Files_To_New_Folder()
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 = "I:\Funding\`JPM Bundles"
strDestFolder = "H:\JPM Bundles"
On Error Resume Next
x = GetAttr(strDestFolder) And 0
If Err = 0 Then
PathExists = True
Overwrite = MsgBox("The folder may contain duplicate files," & vbNewLine & _
"Do you wish to overwrite existing files with same name?", vbYesNo, "Alert!")
If Overwrite <> vbYes Then Exit Sub
Else:
PathExists = False
If PathExists = False Then MkDir (strDestFolder)
End If
Set objFSO = New FileSystemObject
Set objFolder = objFSO.GetFolder(strSourceFolder)
Counter = 0
If Not objFolder.Files.Count > 0 Then GoTo NoFiles
For Each objFile In objFolder.Files
If InStr(1, objFile.Name, ".zip") Then
objFile.Copy strDestFolder & "\" & objFile.Name
Counter = Counter + 1
End If
Next objFile
MsgBox "All " & Counter & " Files from " & vbCrLf & vbCrLf & strSourceFolder & vbNewLine & vbNewLine & _
" copied/moved to: " & vbCrLf & vbCrLf & strDestFolder, , "Completed Transfer/Copy!"
Set objFile = Nothing: Set objFSO = Nothing: Set objFolder = Nothing
Exit Sub
NoFiles:
MsgBox "There Are no files or documents in : " & vbNewLine & vbNewLine & _
strSourceFolder & vbNewLine & vbNewLine & "Please verify the path!", , "Alert: No Files Found!"
Set objFile = Nothing: Set objFSO = Nothing: Set objFolder = Nothing
Application.ScreenUpdating = True
Application.EnableEvents = True
Exit Sub
End Sub
Bookmarks