473,748 Members | 2,891 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\CUST OMERS\ID???BC.* "

DirectoryInfo di = new DirectoryInfo(f older);
FileInfo[] fileNames = di.GetFiles("Al lInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOM ERS 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 4583
On Jun 17, 1:48*pm, DavidM <Dav...@discuss ions.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\CUST OMERS\ID???BC.* "

* * * * * * * * DirectoryInfo di = new DirectoryInfo(f older);
* * * * * * * * FileInfo[] fileNames = di.GetFiles("Al lInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOM ERS 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...@discuss ions.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\CUST OMERS\ID???BC.* "

* * * * * * * * DirectoryInfo di = new DirectoryInfo(f older);
* * * * * * * * FileInfo[] fileNames = di.GetFiles("Al lInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOM ERS 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.GetDi rectories (@"C:\INPUT\CUS TOMERS
\ID???BC.*"))
foreach( string file in Directory.GetFi les( folder,
("AllInput_*.xm l") ))

Jun 27 '08 #3
Thank you all!

"Ignacio Machin ( .NET/ C# MVP )" wrote:
On Jun 17, 1:48 pm, DavidM <Dav...@discuss ions.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\CUST OMERS\ID???BC.* "

DirectoryInfo di = new DirectoryInfo(f older);
FileInfo[] fileNames = di.GetFiles("Al lInput_*.xml");

Basically, I have lots of foldres under C:\INPUT\CUSTOM ERS 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.GetDi rectories (@"C:\INPUT\CUS TOMERS
\ID???BC.*"))
foreach( string file in Directory.GetFi les( folder,
("AllInput_*.xm l") ))

Jun 27 '08 #4

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

Similar topics

3
4363
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 learned how to use those COM Interop things. And Im able to write code that allows me to open existing Word documents and existing Excel spreadsheets. And I know how to write into specific columns and rows of the spreadsheet.
1
383
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 file in Directory.GetFiles("pic1.*") file.Delete() but will need to use a recursive algorythm to get all its subdirectories
3
30588
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 another way to enumerate files and subdirectories recursively which doesn't take too much memory in CS?
1
1377
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!!! I have a webserver setup in my home, with an index file that is an access comtrol page, that, if the authentication is sucessfull, takes the user to a
11
5808
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 method is to be inherited by all listing classes to allow for * list-wide deletion of latent server-created ZIP files for security purposes *
5
3242
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 Visual c++ 2005 Express edition and i was wondering how to scan a directory that the user inputs the path and the program scans that directory and gets the file names only. i wrote a program to copy from files and i need to scan the directory that...
2
1560
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 there any controls or simple code out there to do this? TIA -- ats@jbex
2
3201
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, "cscope -R" wouldn't scan that linked directoty. What option should I use to scan linked source directory using
7
2095
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 are all the exact same format. I need to create some code in vb using microsoft access that will scan through this directory of excel files, and pull certain cells of information from each of them, and store this information into an access database....
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.