473,320 Members | 2,112 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,320 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 4551
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.