From: Haris Bogdanovi� on
How to go through a folder and collect
all subfolder names as strings into a list ?

Thanks


From: Jorge Gajon on
On 2010-06-25, Haris Bogdanovi� <fbogdanovic(a)xnet.hr> wrote:
> How to go through a folder and collect
> all subfolder names as strings into a list ?
>

You should read chapters 14 and 15 of Peter Seibel's
"Practical Common Lisp".

http://gigamonkeys.com/book/

--
Jorge Gajon
Mexico City
http://gajon.org
From: Pascal J. Bourguignon on
"Haris Bogdanovi�" <fbogdanovic(a)xnet.hr> writes:

> How to go through a folder and collect
> all subfolder names as strings into a list ?

(mapcar (lambda (path) (first (last (pathname-directory path))))
(directory "folder/*/"))

--
__Pascal Bourguignon__ http://www.informatimago.com/
From: Andrew Main on
On 26/06/2010 6:24 a.m., Haris Bogdanovi� wrote:
> How to go through a folder and collect
> all subfolder names as strings into a list ?
>
> Thanks
>


With cl-fad (http://weitz.de/cl-fad/) installed, do:

(use-package 'cl-fad)

(defun subdirs (dir)
(remove-if-not #'directory-pathnaname-p (list-directory dir)))

then (subdirs some-directory) => a list of directories in some-directory

Andrew
From: Andrew Main on
On 26/06/2010 11:08 a.m., Andrew Main wrote:
> On 26/06/2010 6:24 a.m., Haris Bogdanovi� wrote:
>> How to go through a folder and collect
>> all subfolder names as strings into a list ?
>>
>> Thanks
>>
>
>
> With cl-fad (http://weitz.de/cl-fad/) installed, do:
>
> (use-package 'cl-fad)
>
> (defun subdirs (dir)
> (remove-if-not #'directory-pathnaname-p (list-directory dir)))
>
> then (subdirs some-directory) => a list of directories in some-directory
>
> Andrew

Sorry, that will get you a list of pathnames. I'm not sure what the best
way to turn that into a list of strings is, but mapping
princ-to-string across that list would work.

But first, make sure that whatever you're doing with the results
actually needs strings and can't be done with a pathname.

Andrew