473,903 Members | 4,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing a directory

I'm trying to parse a directory, but am not sure of the best way of
doing it. Preferably using only .net instructions. Can anyone give me an
idea of how to do this?

Thanks in advance for any help that anyone can give me...

John
Nov 15 '05 #1
2 6810
What do you mean "parsing a directory"? Do you mean parsing a directory
path, or enumerating the files in a directory?

Well, the Path class will help parsing the path. The Directory and
DirectoryInfo will help enumerate the files.

"John Young" <polomint77_ATA TATATAT_hotmail .com> wrote in message
news:uU******** ******@TK2MSFTN GP09.phx.gbl...
I'm trying to parse a directory, but am not sure of the best way of
doing it. Preferably using only .net instructions. Can anyone give me an
idea of how to do this?

Thanks in advance for any help that anyone can give me...

John

Nov 15 '05 #2
using System.IO;

Write a separate method (so it can be used recursively), and pass it a
parameter that represents the directory where you want things to start.

In that method, create a DirectoryInfo object, passing the directory's path
in the ctor. That object will have its own collection of DirectoryInfo
objects called Directories, and its own collection of FileInfo objects
called Files.

Typically, you would do what you want to do for each FileInfo in Files, and
for each DirectoryInfo in Directories, call the method recursively. That
way, you can process all the files and directories in a subtree of arbitrary
depth. The order in which you do these things will determine whether you do
a depth-first or breadth-first traversal of the directory tree.

"John Young" <polomint77_ATA TATATAT_hotmail .com> wrote in message
news:uU******** ******@TK2MSFTN GP09.phx.gbl...
I'm trying to parse a directory, but am not sure of the best way of
doing it. Preferably using only .net instructions. Can anyone give me an
idea of how to do this?

Thanks in advance for any help that anyone can give me...

John

Nov 15 '05 #3

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

Similar topics

1
2253
by: Ajay Brar | last post by:
hi! i get a value error when parsing an xml file. This is because it can't find the DTD - ValueError: unknown url type: ../um_xml/um.dtd From what i have discovered in the archives, this happens when your XML and DTD file are not in your current directory i have the directory structure home
35
3405
by: .:mmac:. | last post by:
I have a bunch of files (Playlist files for media player) and I am trying to create an automatically generated web page that includes the last 20 or 30 of these files. The files are created every week and are named XX-XX-XX.ASX where the X's represent the date i.e. 05-22-05.asx The files are a specific format and will always contain tags like the following: <TITLE>My media file title</TITLE> <AUTHOR>Media file author</AUTHOR> <Ref href =...
3
2252
by: Arsalan Ahmad | last post by:
Hi, I have recently uploaded a file in a webserver. When i try to access it via browser, I get following error: This is working fine in my local copy. Any idea what could be wrong. Server Error in '/' Application. ---------------------------------------------------------------------------- ---- Parser Error
2
1485
by: Brett | last post by:
I uploaded an ASP.NET website from my developer machine to a remote server. The paths differ slightly as follows: Local Path: C:\Inetpub\wwwroot\mysite Server Path: C:\Inetpub\mysite.com\ I get the following error on the server:
2
3614
by: Jean-Marie Vaneskahian | last post by:
Reading - Parsing Records From An LDAP LDIF File In .Net? I am in need of a .Net class that will allow for the parsing of a LDAP LDIF file. An LDIF file is the standard format for representing LDAP objects. I need to be able to read the records from an LDIF file into ..Net. There exists a Perl module that will do exactly this called Net::LDAP::LDIF but I am wanting to port my code over to .Net and cannot find anything with similar...
0
1065
by: Peter D. Dunlap | last post by:
I've got a site I'm working on that works fine using the VS2005 internal browser. I need to test it from another machine on the network, so I set up a new virtual directory in IIS (on Windows XP SP2) and copied the site into it. I get the error: XML Parsing Error: not well-formed This happens on the Page directive at the top of the Default.aspx page.
2
1878
by: codemaster | last post by:
Hi, I am using perl in windows platform. I have a directory structure \Dir\Data\tran\Archive\TDB\Log. There are files in the TDB directory with .dat extension. I need to parse the TDB directory inorder to identify the .dat files individually. I have the logic as follows: # file path $input = "\\Dir\\Data\\tran\\".$ARGV; $archive = "\\Dir\\Data\\tran\\Archive\\".$ARGV; $archLog = $archive."\\Log"; die "Can not open archive directory"
2
2445
by: Gary42103 | last post by:
Hi I need Perl Script to do Data Parsing using existing data files. I have my existing data files in the following directory: Directory Name: workfs/ams Data File Names: 20070504.dat, 20070503.dat, 20070502.dat In each of above data files there will be some millions of records. So my job is read those data files and also read first 3 letters of each record in all above data files and write into new data files.For example
2
3072
by: nedelm | last post by:
My problem's with parsing. I have this (arbitrary, from a file) string, lets say: "Directory: /file{File:/filename(/size) }" I would like it to behave similar to LaTeX. I parse it, and then I write it out for diferent variables, like:
0
11282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10500
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8048
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
7206
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
5894
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
6088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4308
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3324
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.