comp.lang.ada
 help / color / mirror / Atom feed
From: sk <noname@myob.com>
Subject: Re: Directories and files
Date: Tue, 19 Feb 2002 20:21:01 -0600
Date: 2002-02-19T20:21:01-06:00	[thread overview]
Message-ID: <mailman.1014171722.14276.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: a4ufp8$o2p$1@news.ya.com

Hi, 

If you are using Gnat, look at Gnat.Directory_Operations.

This package provides the necessary primitives to traverse
a directory and change directories from within code.

If you need to detect that a file within the directory is
a sub-directory, use the function "Is_Directory" from
Gnat.Os_Lib.

For more detailed file information bind to the OS code of
your choice. On linux for example, I bound to all the 
necessary functions to be able to "stat" from within an Ada 
procedure which enables me to ignore sockets etc.


Pseudo-code :

GDOP renames Gnat.Directory_Operations;

Store Directory name of interest in a queue

loop

   Is the directory name queue empty ?
   YES : Exit loop
   NO  : 
       Get the Directory name and GDOP.Open it.

       while GDOP.Read (... opened directory) /= no more files

           Do what you want with the file name.

           Is the file name a directory ?
           YES : Add the name to the directory name queue.
           NO  : No Action

       end loop;

       GDOP.Close ( ... opened directory).       

end loop;

-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



  parent reply	other threads:[~2002-02-20  2:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-19 21:23 Directories and files Jos� Alberto
2002-02-19 21:35 ` tmoran
2002-02-20  8:14   ` Jos� Alberto
2002-02-20 17:54     ` Jos� Alberto
2002-02-21  8:10       ` tmoran
2002-02-20  2:21 ` sk [this message]
     [not found] <mailman.1014237242.7594.comp.lang.ada@ada.eu.org>
2002-02-21  7:19 ` Jos� Alberto
  -- strict thread matches above, loose matches on Subject: below --
2002-02-21 10:09 Gautier Write-only-address
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox