473,230 Members | 1,682 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Directory Scan using Wildcards?

Hi, does anyone know if I can scan a subdirectory using wildcards? I do not
see a way to do this using:
string folder = @"C:\INPUT\CUSTOMERS\ID???BC.*"

DirectoryInfo di = new DirectoryInfo(folder);
FileInfo[] fileNames = di.GetFiles("AllInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOMERS and I want to the
..XML files I'm looking for only exists under the ID???BC folders. So I
wanted to dymanically get a list of all the ID???BC folders and then scan
each one for the specified files.

I was trying to do this to avoid having to scan all folders. Plus I need a
dymaic list of all the ??? customers.

Jun 27 '08 #1
3 4547
On Jun 17, 1:48*pm, DavidM <Dav...@discussions.microsoft.comwrote:
Hi, does anyone know if I can scan a subdirectory using wildcards? *I donot
see a way to do this using:

* * * * * * * *string folder = @"C:\INPUT\CUSTOMERS\ID???BC.*"

* * * * * * * * DirectoryInfo di = new DirectoryInfo(folder);
* * * * * * * * FileInfo[] fileNames = di.GetFiles("AllInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOMERS and I want to the
.XML files I'm looking for only exists under the ID???BC folders. *So I
wanted to dymanically get a list of all the ID???BC folders and then scan
each one for the specified files. *

I was trying to do this to avoid having to scan all folders. *Plus I need a
dymaic list of all the ??? customers.
RTFM.

http://msdn.microsoft.com/en-us/libr...60(VS.71).aspx
Jun 27 '08 #2
On Jun 17, 1:48*pm, DavidM <Dav...@discussions.microsoft.comwrote:
Hi, does anyone know if I can scan a subdirectory using wildcards? *I donot
see a way to do this using:

* * * * * * * *string folder = @"C:\INPUT\CUSTOMERS\ID???BC.*"

* * * * * * * * DirectoryInfo di = new DirectoryInfo(folder);
* * * * * * * * FileInfo[] fileNames = di.GetFiles("AllInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOMERS and I want to the
.XML files I'm looking for only exists under the ID???BC folders. *So I
wanted to dymanically get a list of all the ID???BC folders and then scan
each one for the specified files. *

I was trying to do this to avoid having to scan all folders. *Plus I need a
dymaic list of all the ??? customers.
You can use
foreach(string folder in Directory.GetDirectories (@"C:\INPUT\CUSTOMERS
\ID???BC.*"))
foreach( string file in Directory.GetFiles( folder,
("AllInput_*.xml") ))

Jun 27 '08 #3
Thank you all!

"Ignacio Machin ( .NET/ C# MVP )" wrote:
On Jun 17, 1:48 pm, DavidM <Dav...@discussions.microsoft.comwrote:
Hi, does anyone know if I can scan a subdirectory using wildcards? I do not
see a way to do this using:

string folder = @"C:\INPUT\CUSTOMERS\ID???BC.*"

DirectoryInfo di = new DirectoryInfo(folder);
FileInfo[] fileNames = di.GetFiles("AllInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOMERS and I want to the
.XML files I'm looking for only exists under the ID???BC folders. So I
wanted to dymanically get a list of all the ID???BC folders and then scan
each one for the specified files.

I was trying to do this to avoid having to scan all folders. Plus I need a
dymaic list of all the ??? customers.

You can use
foreach(string folder in Directory.GetDirectories (@"C:\INPUT\CUSTOMERS
\ID???BC.*"))
foreach( string file in Directory.GetFiles( folder,
("AllInput_*.xml") ))

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bob | last post by:
What I want to do is write a program that reads through a Word Document, finds certain words or sentences I want, and then paste into an Excel spreadsheet. I dont know much about C#. But I...
1
by: Earl Teigrob | last post by:
Does someone have or know of an algorythm (method) that will delete all files under a give directory and its subdirectories based on a wildcard mask? I can use this for one directory for each...
3
by: S. Han | last post by:
I'm using Directory.GetFiles to enumerate files in a directory. The problem is if you have to enumerate all files + subdirectories recursively, it takes too much memory, and it fails. Is there...
1
by: Psapg | last post by:
Hi! I'm new to javasript, and i must confess to have borowed a few free scripts from the net to satisfie my needs.... Still i can't find even an idea of ascipt to do this... Please Help!!! ...
11
by: comp.lang.php | last post by:
Once again, I thought my class method deleteZip() would do the trick, but it never deletes any .zip* file found in a directory: /** * Delete any latent ZIP files found in this album. This...
5
by: johnwayne83 | last post by:
This is my first semester in c++ and i took java last semester. I need some help and i really cant find any information that has helped me or to point me in the right direction. I am using...
2
by: ats | last post by:
Hope this is the correct group. I am looking to place a set of constantly changing excel files in a directory on my web server. I want to display these as a list of clickable links on a page. Are...
2
by: sunset85 | last post by:
Hi. I'm trying to scan linked source directory using "cscope" In normal case (without linked source directory), "cscope -R " works vety well. But when linked source directory included,...
7
by: paul86 | last post by:
Hi all, I have a vb question that i'm hoping I can get some help with. I have a directory of excel files (probably about 1000) of them. They are quote sheets for the company I work for, and they...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.