Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create directory list

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
145 Views, 3 Replies

Create directory list

Is there any function in lisp to list a directory's contents?

chad
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Attached are some files that I dl from cadence mag site. Bill Kramer wrote
them. You can go to the cadence web site and get the full details on how it
runs. I haven't actually used it yet, but you never know when something
like this could be useful.

"Chad" wrote in message
news:f038545.-1@WebX.maYIadrTaRb...
> Is there any function in lisp to list a directory's contents?
>
> chad
>
Message 3 of 4
Anonymous
in reply to: Anonymous

Chad;

Look up the following in the online help (if you're using A2k):

(vl-directory-files [directory pattern directories])

Cheers

"Chad" wrote in message
news:f038545.-1@WebX.maYIadrTaRb...
> Is there any function in lisp to list a directory's contents?
>
> chad
>
Message 4 of 4
Anonymous
in reply to: Anonymous

If you have Express:

;makes multiple levels of directories
(defun mdirs (dir / mkdir pos)
(setq mkdir (substr dir 1 (setq pos (vl-string-position 92 dir 0))))
(while (not (vl-directory-files dir "*.*"))
(setq mkdir (substr dir 1 (setq pos (vl-string-position 92 dir (1+
pos)))))
(if (not (vl-directory-files mkdir "*.*"))
(acet-file-mkdir mkdir)
)
mkdir
)
)

;removes multiple levels of directories until it finds one with contents
(defun rdirs (dir / contents pos) (setq dir (vl-string-right-trim "\\" dir))
(while (> 3 (length (setq contents (vl-directory-files dir "*.*"))))
(if (equal contents '("." ".."))
(acet-file-rmdir dir)
)
(setq dir (substr dir 1 (vl-string-position 92 dir 0 T)))
)
)

--
Eric S. eschneider@jensenprecast.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost