Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 29th, 2002, 09:26 PM
Beans4You's Avatar
Beans4You Beans4You is offline
Some day I will be a Lambda!
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: NJ
Posts: 18 Beans4You User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Parse a physical drive

I need to parse a physical drive and get a result similar to a [DIV /S] from the command line. I need to know how many nodes from the root each file is and the file type. Example: FileName:="TeastMe.txt" NodeCount:="14" or something. Could anyone help me please.

Thank You
Eric Cashwell

Reply With Quote
  #2  
Old July 10th, 2002, 08:31 PM
towk towk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Belgrade, Yugoslavia
Posts: 7 towk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
not quite clear

It's not quite clear what are you trying to accomplish.

If what you want is to parse a string like "/home/user/public_html/welcome.html" (or similarly, "C:\home\user\public_html\welcome.html") and return something like
Code:
   name=welcome.html
   level=3 // with zero-based level number

then it's a trivial task of simply searching the string for the occurence of '/' or '\'.

If you're looking for a concrete implementation in a particular language, then you should probably ask it in that language's forum (I would call it bad taste to resort here to any language in particular :)


If you actually want to really "parse a physical drive" and get the same result for a given file name, it would require knowledge of the underlying filesystem. Since there is a plethora of those available (among them Ext2, Ext3, NTFS, FAT[32], ReiserFS, UFS; just to mention a few), so it's impossible to answer your question. Even then, it's not a matter of algorithms, but rather a question of "specification of filesystem implementation".


If your question is something completely different, then accept my apology for not knowing any better.

That's it.

Reply With Quote
  #3  
Old August 3rd, 2002, 01:49 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 184
you asked in the algorithms forum, this one is easy. here you go:
(pseudo-code)
Code:
global file_list;
function add_to_list(n,d,t) {
  l=length(file_list);
  file_list[l]->name=n;
  file_list[l]->level=d;
  file_list[l]->type=t;
}

function parse_dir(dirname) {
  depth++;
  static depth;
  for each entry {
      add_to_list(dirname+"\"+entry.name,depth,entry.type);
    if (is it a directory) {
      parse_dir(dirname+"\"+entry.name); // recursive call to get all files inside
    }
  }
}

parse_dir("(DRIVE LETTER):\")


does this fit to your question?
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Parse a physical drive


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT