473,385 Members | 1,154 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,385 software developers and data experts.

How to approach a problem..

Hi all,

I'm making a diskspace analyser such that after you select the directory
that you want analysed and hit go, it iterates through all the directories
and files and gather information on them. I'd like to be able to offer lots
of different types of information to the user, including comparitive sizes
of different file types, file type counts, top ten largest directories, empty
files and much more besides.

I'm wondering if anyone could suggest a solution to two different aspects
of this

1. What data structure should I use. This doesnt have to be restricted to
those that come with the .net framework, but whatever is used needs to be
efficient and fast at accessing the information gathered on the different
directories

2. What should I use to gather the statistics that I'll need to be able to
analyse the directories and files. I'm basically thinking that I will need
to make a custom object but I'm worried that this could get really complicated.
Perhaps I would make a directory info object that would contain information
on itself and the directories contained underneath it?

I'm pretty confused about how to gather these statistics and how to analyse
them efficiently

Any advice or design approaches would be very greatfully received

Thank all

Simon

Jul 21 '05 #1
4 1169
Hi,

I'd build custom objects representing a directory, a file, a file collection
and a directory collection.
The file and the directory objects would be able to gather and provide
information about themselves given the physical path.
The collections would be used to store child files and directories.

In the end, there would be an object graph rooted at the directory specified
for analysis and representing the structure beneath this directory (and the
respective information).
I'd also make report classes responsible to generate file type/file size
breakdown reports and other reports you will need. These would use directory
objects as data sources.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"SimonH" <no**@hotmail.com> wrote in message
news:67*********************@news.microsoft.com...
Hi all,

I'm making a diskspace analyser such that after you select the directory
that you want analysed and hit go, it iterates through all the directories
and files and gather information on them. I'd like to be able to offer
lots of different types of information to the user, including comparitive
sizes of different file types, file type counts, top ten largest
directories, empty files and much more besides.

I'm wondering if anyone could suggest a solution to two different aspects
of this

1. What data structure should I use. This doesnt have to be restricted to
those that come with the .net framework, but whatever is used needs to be
efficient and fast at accessing the information gathered on the different
directories

2. What should I use to gather the statistics that I'll need to be able to
analyse the directories and files. I'm basically thinking that I will need
to make a custom object but I'm worried that this could get really
complicated. Perhaps I would make a directory info object that would
contain information on itself and the directories contained underneath it?

I'm pretty confused about how to gather these statistics and how to
analyse them efficiently
Any advice or design approaches would be very greatfully received

Thank all

Simon


Jul 21 '05 #2
On 25 Feb 2005, SimonH <no**@hotmail.com> postulated in
news:67*********************@news.microsoft.com:
Hi all,

I'm making a diskspace analyser such that after you select the directory that you want analysed and hit go, it iterates through all the directories and files and gather information on them. I'd like to be able to offer lots of different types of information to the user, including comparitive sizes of different file types, file type counts, top ten largest directories, empty files and much more besides.

I'm wondering if anyone could suggest a solution to two different aspects of this

1. What data structure should I use. This doesnt have to be restricted to those that come with the .net framework, but whatever is used needs to be efficient and fast at accessing the information gathered on the different directories

2. What should I use to gather the statistics that I'll need to be able to analyse the directories and files. I'm basically thinking that I will need to make a custom object but I'm worried that this could get really complicated. Perhaps I would make a directory info object that would contain information on itself and the directories contained underneath it?

I'm pretty confused about how to gather these statistics and how to analyse them efficiently

Any advice or design approaches would be very greatfully received

Thank all

Simon


Simon,

IIWY, I'd start at the bottom with the windows file system. You've
got to learn to Interop and call the Windows API--then you don't need
to worry about what the .net interfaces.

There's a new file system coming out with future systems. I'd learn
as much about that as possible and support it. One trick to getting a
new utility app off the mark is to support an emerging technology.

I'm not sure what statistics you're getting at.

-- ipgrunt

Jul 21 '05 #3
Hi Simon,

I'm making a diskspace analyser such that after you select the directory
that you want analysed and hit go, it iterates through all the directories
and files and gather information on them. I'd like to be able to offer
lots of different types of information to the user, including comparitive
sizes of different file types, file type counts, top ten largest
directories, empty files and much more besides.

I'm wondering if anyone could suggest a solution to two different aspects
of this

1. What data structure should I use. This doesnt have to be restricted to
those that come with the .net framework, but whatever is used needs to be
efficient and fast at accessing the information gathered on the different
directories
Personally, I wonder how you are going to collect information on a
heirarchical system with keeping track of the heirarchy itself. Two methods
come to mind: (1) a simple list where each item has associated size, type,
and path information, and where directories contain summary information, and
(2) a tree structure where a directory contains two lists: a list of files
and a list of directories. Files in this structure are different than
directories in that they do not contain files, but may have a type and size,
while directories can only have a size. Both can have security attributes.

To decide which mechanism to offer, it helps to perform a
Commonality-Variability Analysis. This simple analysis technique helps you
to decide what capabilities of your objects to place in different places in
your heirarchy.

My gut tells me that the tree-structure is more likely to produce the
results you need.

2. What should I use to gather the statistics that I'll need to be able to
analyse the directories and files. I'm basically thinking that I will need
to make a custom object but I'm worried that this could get really
complicated. Perhaps I would make a directory info object that would
contain information on itself and the directories contained underneath it?


You are unlikely to get the data collection methods you'd want out of the
basic file and directory objects in .net. I would suggest that you would
want to encapsulate these objects within a wrapper of your own that provides
the statistical methods you desire and which contain the tree members that
you need.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
Jul 21 '05 #4
Sincerest thanks for your comments all

Simo

Jul 21 '05 #5

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

Similar topics

0
by: Perttu Pulkkinen | last post by:
I ask all php-freaks say how they feel this CMS approach especially from the point of view of 1) admin usability, 2) user rights management and) database speed. In my approach webcontent could...
7
by: Chinook | last post by:
OO approach to decision sequence? --------------------------------- In a recent thread (Cause for using objects?), Chris Smith replied with (in part): > If your table of photo data has...
2
by: Rene | last post by:
Hi, In my VB6 application I'm using a class/object that is using full-async ADO. I can start multiple queries, the class stores the ADODB.Recordset object in an array and waits for the...
16
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
4
by: integragreg | last post by:
I apologize for the length of this post, but this particular problem takes a bit of explanation. I have a set of hierarchically-related classes that I want to serialize on demand at runtime. ...
16
by: Dotnet | last post by:
I want to so the "right thing". But first, I have a confession to make. I've built a few ASP.NET sites now (Version 2.0), and they all work fine. However, I have (and here's the confession) used...
9
by: seguso | last post by:
Hello, I have a very simple problem I don't know how to approach. I need a suggestion about the general approach to take. I have a bunch of html pages on a machine, all in the same folder...
14
by: Leah | last post by:
I am a student and are required to build a website that provide services (client-server). I need advice in choosing approach or to be exact the methodology that appropriate for such development....
5
by: jehugaleahsa | last post by:
Hello: I am trying to find what is the very best approach to business objects in Windows Forms. Windows Forms presents an awesome opportunity to use DataTables and I would like to continue doing...
20
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.