473,396 Members | 2,016 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,396 software developers and data experts.

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 6788
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_ATATATATAT_hotmail.com> wrote in message
news:uU**************@TK2MSFTNGP09.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_ATATATATAT_hotmail.com> wrote in message
news:uU**************@TK2MSFTNGP09.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
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...
35
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...
3
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...
2
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...
2
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...
0
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...
2
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...
2
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,...
2
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.