ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileSearch dislikes Zip-files (https://www.excelbanter.com/excel-programming/275817-filesearch-dislikes-zip-files.html)

Hub van de Laar

FileSearch dislikes Zip-files
 
L.S.

I encountered some problems using the FileSearch object.
Using the Macro you'll find below, it doesn'list the zip-
files that reside in the specified directory. When
replacing the Filename "*.zip" by "*.*", it lists all
files except the zip-files.

I've already reviewed the contents of the collections
PropertyTests and FileTypes, but had no results.

Using the interactive FileSearch from the Excel-sheet via
the menu-option provides the same results.


Private Sub CheckAllZipFiles()
Dim FS As FileSearch, I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "D:\"
.FileType = msoFileTypeAllFiles
.Filename = "*.zip"
.SearchSubFolders = True
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(I)
Next I
Else
MsgBox "No files found."
End If
End With
End Sub


Ron de Bruin

FileSearch dislikes Zip-files
 
Please stay in your other thread Hub
See a possible solution in there


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Hub van de Laar" wrote in message ...
L.S.

I encountered some problems using the FileSearch object.
Using the Macro you'll find below, it doesn'list the zip-
files that reside in the specified directory. When
replacing the Filename "*.zip" by "*.*", it lists all
files except the zip-files.

I've already reviewed the contents of the collections
PropertyTests and FileTypes, but had no results.

Using the interactive FileSearch from the Excel-sheet via
the menu-option provides the same results.


Private Sub CheckAllZipFiles()
Dim FS As FileSearch, I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "D:\"
.FileType = msoFileTypeAllFiles
.Filename = "*.zip"
.SearchSubFolders = True
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(I)
Next I
Else
MsgBox "No files found."
End If
End With
End Sub




Tom Ogilvy

FileSearch dislikes Zip-files
 
Change
.filename = "*.zip"
to
.filename = ".zip"

--
Regards,
Tom Ogilvy

Hub van de Laar wrote in message
...
L.S.

I encountered some problems using the FileSearch object.
Using the Macro you'll find below, it doesn'list the zip-
files that reside in the specified directory. When
replacing the Filename "*.zip" by "*.*", it lists all
files except the zip-files.

I've already reviewed the contents of the collections
PropertyTests and FileTypes, but had no results.

Using the interactive FileSearch from the Excel-sheet via
the menu-option provides the same results.


Private Sub CheckAllZipFiles()
Dim FS As FileSearch, I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "D:\"
.FileType = msoFileTypeAllFiles
.Filename = "*.zip"
.SearchSubFolders = True
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(I)
Next I
Else
MsgBox "No files found."
End If
End With
End Sub




Tom Ogilvy

FileSearch dislikes Zip-files
 
That may be an operating system thing. I believe in Windows XP, you can
look at the interior of a zip file like it was a folder - so that might be
what filesearch is doing.

However, in Excel 2000 on Windows XP professional, It worked for me - found
the zip files. BUt on some, I was getting a double find - found it twice.

I guess the robust solution would be to have it pull a list of all files,
then run through the list and extract the zip files, or use the filesystem
object or the windows API.

--
Regards,
Tom Ogilvy



Ron de Bruin wrote in message
...
I tested it in Win XP Office 2002 and 2003
And it don't see Zip files Tom

With and without the *

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Tom Ogilvy" wrote in message

...
Change
.filename = "*.zip"
to
.filename = ".zip"

--
Regards,
Tom Ogilvy

Hub van de Laar wrote in message
...
L.S.

I encountered some problems using the FileSearch object.
Using the Macro you'll find below, it doesn'list the zip-
files that reside in the specified directory. When
replacing the Filename "*.zip" by "*.*", it lists all
files except the zip-files.

I've already reviewed the contents of the collections
PropertyTests and FileTypes, but had no results.

Using the interactive FileSearch from the Excel-sheet via
the menu-option provides the same results.


Private Sub CheckAllZipFiles()
Dim FS As FileSearch, I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "D:\"
.FileType = msoFileTypeAllFiles
.Filename = "*.zip"
.SearchSubFolders = True
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(I)
Next I
Else
MsgBox "No files found."
End If
End With
End Sub








Ron de Bruin

FileSearch dislikes Zip-files
 
Hi Tom

Win XP Pro with Excel 2000
Code is working correct for me with a small test

So it seems a Office 2002/2003 problem Tom under Win XP

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Ron de Bruin" wrote in message ...
Hi Tom

I guess the robust solution would be to have it pull a list of all files,
then run through the list and extract the zip files, or use the filesystem
object or the windows API


I think you are right about that

I will test it also on Win XP with Excel 2000 and post
back with the result



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Tom Ogilvy" wrote in message ...
That may be an operating system thing. I believe in Windows XP, you can
look at the interior of a zip file like it was a folder - so that might be
what filesearch is doing.

However, in Excel 2000 on Windows XP professional, It worked for me - found
the zip files. BUt on some, I was getting a double find - found it twice.

I guess the robust solution would be to have it pull a list of all files,
then run through the list and extract the zip files, or use the filesystem
object or the windows API.

--
Regards,
Tom Ogilvy



Ron de Bruin wrote in message
...
I tested it in Win XP Office 2002 and 2003
And it don't see Zip files Tom

With and without the *

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Tom Ogilvy" wrote in message

...
Change
.filename = "*.zip"
to
.filename = ".zip"

--
Regards,
Tom Ogilvy

Hub van de Laar wrote in message
...
L.S.

I encountered some problems using the FileSearch object.
Using the Macro you'll find below, it doesn'list the zip-
files that reside in the specified directory. When
replacing the Filename "*.zip" by "*.*", it lists all
files except the zip-files.

I've already reviewed the contents of the collections
PropertyTests and FileTypes, but had no results.

Using the interactive FileSearch from the Excel-sheet via
the menu-option provides the same results.


Private Sub CheckAllZipFiles()
Dim FS As FileSearch, I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "D:\"
.FileType = msoFileTypeAllFiles
.Filename = "*.zip"
.SearchSubFolders = True
If .Execute 0 Then
For I = 1 To .FoundFiles.Count
Debug.Print .FoundFiles(I)
Next I
Else
MsgBox "No files found."
End If
End With
End Sub













All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com