Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
At the present time I have created a form with some recrusion to search directories and sub directories but I do not wish to search all files. I need help with searching only the file extensions that I specify such as .sys, .exe and so forth. The example i have populates the contents of the directory with the selection I have made with a combobox (Eg. C:\ .EXE) which pulls up all files ending with the file extension .exe , now is there some way to go about doing this without the use of a listbox? What I mean to ask is there anyway that I can only scan thoes file extensions and if its not that specific file extension to skip the file?
Posted
Updated 5-Oct-11 16:01pm
v2

1 solution

I'm not clear about your question. But let see this link.
 
Share this answer
 
Comments
Dale 2012 5-Oct-11 23:57pm    
This code simply lists the files from a directory to a listbox which is good except I am only interested with certian file extensions and not every file. Also I wish to not need a listbox. In short how can I select a drive from lets say a combobox and then have a recrusive call run through only the selected file extensions (ex...... .exe .com .sys .ini ect ect) and not the other files such as .txt or .iso
Sergey Alexandrovich Kryukov 6-Oct-11 1:07am    
You missed one line right after the end of the code. This line explains how to filter by extension.
--SA
Sergey Alexandrovich Kryukov 6-Oct-11 1:07am    
Correct, a 5.
--SA
Dale 2012 6-Oct-11 2:27am    
ok I have looked it over and I appologize for now seeing it but I have tried to use this code:

For Each file1 In Directory.GetFiles(dir(".exe"))

dir = string

Conversion from string ".exe" to type 'Integer' is not valid.

How do i overcome this error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900