TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: domenicomaria on January 15, 2023, 01:41:15 PM
-
Is there any lisp routine that emulates the DOS TREE command ?
And that it also inserts TABs for each nested level ?
-
Have you tried from DOS (CMD prompt) :
TREE > tree.txt
-
Yes
But i need to do it with Lisp
-
Perhaps have a look at the 'SHELL' command from lisp
Something like :
(command-s "shell" "TREE > tree.txt ")
untested:
-
@kdub
it seems it doesn't work
but still I want to try to do it with Vlisp only
it shouldn't be difficult
however suggestions are welcome
thank you
-
Forse intendi Dos_DirTree...
Credits: Tony Tanzillo?
; Function: ALE_UtlFilesGetFolders
;
; Version 1.00 - 09/06/2006
;
; Description:
; Returns a list of subdirectories found in the specified directory,
; the return values contain trailing double-backslashes (\\)
; if RecFlg = T > scan the entire structure
;
; Arguments:
; In_Pat = A string containing an existing path
; do not need trailing double-backslashes
; if nil or "" uses the current directory.
; RecFlg = flag > T = scan the entire structure
; > nil = do not scan
;
; Examples:
; (ALE_UtlFilesGetFolders "C:\\Temp" nil)
; (ALE_UtlFilesGetFolders "C:\\Temp\\" T)
;
; Return Values:
; [LIST] A list of subdirectories if successful.
;
(defun ALE_UtlFilesGetFolders (In_Pat RecFlg / FilNam OutLst)
(or
(wcmatch In_Pat "*[\\/]")
(setq In_Pat (strcat In_Pat "\\"))
)
(if RecFlg
(ALE_UtlFilesGetFolders_Aux In_Pat)
(foreach ForElm (cddr (vl-directory-files In_Pat nil -1))
(setq OutLst (cons (strcat In_Pat ForElm "\\") OutLst))
)
)
(reverse OutLst)
)
;
; Function: ALE_UtlFilesGetFolders_Aux
; Auxiliary function for: ALE_UtlFilesGetFolders
;
(defun ALE_UtlFilesGetFolders_Aux (In_Pat)
(foreach ForElm (cddr (vl-directory-files In_Pat nil -1))
(setq
FilNam (strcat In_Pat ForElm "\\")
OutLst (cons FilNam OutLst)
)
(ALE_UtlFilesGetFolders_Aux FilNam)
)
)/[code][/size]
-
@marco
Marco grazie ...
questa sera gli do un occhiata
(I'll take a look at it tonight)
ciao