From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,366a90f2146c45e9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-19 18:22:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsswitch.lcs.mit.edu!newsfeed.cwix.com!newsfeed.icl.net!isdnet!enst!enst.fr!not-for-mail From: sk Newsgroups: comp.lang.ada Subject: Re: Directories and files Date: Tue, 19 Feb 2002 20:21:01 -0600 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1014171722 61904 137.194.161.2 (20 Feb 2002 02:22:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 20 Feb 2002 02:22:02 +0000 (UTC) Return-Path: X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19-4.3mdk i686) X-Accept-Language: en Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:20157 Date: 2002-02-19T20:21:01-06:00 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 -------------------------------------