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!

Directory.GetFiles Method

Status
Not open for further replies.

EzehM

Programmer
Feb 27, 2003
86
GB
Please is there a way one can use this method to exclude files with certain extensions (i.e. getting all files in a folder apart from .tmp, .exe etc) or alternatively can you use this method to return files with extensions like .txt, .doc, .xls but exclude .tmp and .exe)

Thanks in Advance
 
You could create an ArrayList object from these arrays:
Directory.GetFiles("*.*")
Directory.GetFiles("*.exe")
Directory.GetFiles("*.tmp")

Convert back to an array, then sort and work through the items that appear once.

Cheers,
ND [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top