comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » File Listings
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: File Listings [message #6950 is a reply to message #6816] Thu, 29 August 1996 00:00 Go to previous message
Brian C. Ballard is currently offline  Brian C. Ballard
Messages: 3
Registered: August 1996
Junior Member
Bon Jour, autre temp,

This is a summary of what I found out about my original question.
Thanks to Jim Pendletom of RSI (US) and Peter Mason of CSIRO (AU) for
their help.

Ayer, escribi:
> ---- Question ----
> Does anyone know how to get a simple directory listing (in text format)
> under windows? (Like "dir" in good old DOS.)

I feel foolish for missing the FINDFILE function in the manuals. Here's
part of what I ended up writing if anyone cares (UNIX works, Windows not
tested yet):
<begin>
...
'unix': begin
...
;Get the directory listing, send errors to bit bucket
spawn, [ '/bin/sh', '-c', 'ls -1FLa ' +path+ ' 2> /dev/null'], $
junks, count = junkv, /noshell

;Dirs will end in "/", files don't
j = where( strpos( junks, '/') ge 0, junkv)
if ( junkv eq 0) then dirs = "" $
else begin
;Build the dirs list from elements that ended in /
dirs = junks( j)
;Chop the "/" from the end of each element
for i = 0, junkv-1 do $
dirs(i) = strmid( dirs(i), 0, strlen( dirs(i))-1)
endelse
;Build file path/name, take care of root dir special case
if ( path ne '/') then $
junks2 = path + "/" + filt $
else $
junks2 = path + filt
...
end ;case UNIX
'Windows': begin
...
;Get the directory listing
junks = findfile( path + "\" + "*.*")
;Dirs will end in '\', files don't
j = where( strpos( junks, '\') ge 0, junkv)
if (junkv eq 0) then dirs = "" $
else begin
;Build the dirs list from elements that ended in "\"
dirs = junks(j)
;Chop the "\" from the end of each element
for i = 0, junkv-1 do $
dirs(i) = strmid( dirs(i), 0, strlen( dirs(i))-1)
endelse
...
end ; case Windows
...
<end>
NB: path can not end in "/" (unix) or "\" (windows).

Brian C. Ballard
E-mail: bballard@orionint.com
WWW : http://www.orionint.com/~bballard/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: directory tree
Next Topic: Question on using Emacs IDL-shell support with Wave 6.0

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 13:09:59 PDT 2025

Total time taken to generate the page: 1.20311 seconds