Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple program to scan a directory for a certain type of extension 1

Status
Not open for further replies.

jcastilletti

Programmer
Jan 16, 2001
7
US
I am looking for some simple code perhaps using the dir statement or function to search a directory for *.pgp files.

I will then need to decrypt these files.

Any help is greatly appreciated.

John
 
The code below will fill the array Files() with the names (including path) of all the files in the directory DirName.

Code:
Dim DirName As String 
Dim FileName As String 
Dim Files() As String 
Dim Count As Long 

'Put the directory to search in DirName somehow
Count = 0 
FileName = Dir(DirName & "*.pgp") 

If FileName = "" Then 
   MsgBox "No Files Found" 
   Exit Sub 
End If 

While FileName <> &quot;&quot; 
    Count = Count + 1 
    Redim Preserve Files(1 To Count) 
    Files(Count) = DirName &amp; FileName 
    FileName = Dir 
Wend
HTH Ruairi

Could your manufacturing facility benefit from real time process monitoring? Would you like your employees to be able to see up to the minute goal and actual production?
For innovative, low cost solutions check out my website.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top