Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim FSO As Object
- Dim FromPath As String
- Dim ToPath As String
- Dim objFSO As Object
- Dim objFolder As Object
- Dim objSubFolder As Object
- Dim fil As File
- With Application.FileDialog(msoFileDialogFolderPicker) 'Choosing FromPath
- .Show
- FromPath = .SelectedItems(1) & ""
- End With
- With Application.FileDialog(msoFileDialogFolderPicker) 'Choosing ToPath
- .Show
- ToPath = .SelectedItems(1) & ""
- End With
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objFolder = objFSO.GetFolder(FromPath)
- For Each objSubFolder In objFolder.SubFolders
- **Set fils = fsoC.GetFolder(objSubFolder & "").Files**
- For Each fil In fils
- If LCase(Right(fil.Name, 3)) = "zip" Then
- MsgBox "this is a zip file "
- Else
- Sub test()
- Dim fils As Object
- Dim fil As Object
- Dim FromPath As String
- Dim ToPath As String
- Dim objFSO As Object
- Dim objFolder As Object
- Dim objSubFolder As Object
- With Application.FileDialog(msoFileDialogFolderPicker) 'Choosing FromPath
- .Show
- FromPath = .SelectedItems(1) & ""
- End With
- With Application.FileDialog(msoFileDialogFolderPicker) 'Choosing ToPath
- .Show
- ToPath = .SelectedItems(1) & ""
- End With
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set objFolder = objFSO.GetFolder(FromPath)
- For Each objSubFolder In objFolder.SubFolders
- Set fils = objFSO.GetFolder(objSubFolder & "").Files
- For Each fil In fils
- If LCase(Right(fil.Name, 3)) = "zip" Then
- MsgBox "this is a zip file "
- Else
- MsgBox "NOPE"
- End If
- Next
- Next
- End Sub
- A
- -- A.1
- ---- test.txt
- ---- test.zip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement