TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: domenicomaria on January 15, 2023, 01:41:15 PM

Title: DOS TREE command
Post 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 ?
Title: Re: DOS TREE command
Post by: ribarm on January 15, 2023, 01:59:49 PM
Have you tried from DOS (CMD prompt) :
TREE > tree.txt
Title: Re: DOS TREE command
Post by: domenicomaria on January 15, 2023, 02:43:07 PM
Yes
But i need to do it with Lisp
Title: Re: DOS TREE command
Post by: kdub_nz on January 15, 2023, 03:34:26 PM


Perhaps have a look at the 'SHELL' command from lisp
Something like :

(command-s "shell" "TREE > tree.txt ")

untested:
Title: Re: DOS TREE command
Post by: domenicomaria on January 16, 2023, 12:40:13 AM
@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
Title: Re: DOS TREE command
Post by: Marc'Antonio Alessi on January 16, 2023, 06:28:46 AM

Forse intendi Dos_DirTree...


Credits: Tony Tanzillo?
Code: [Select]
; 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]
Title: Re: DOS TREE command
Post by: domenicomaria on January 16, 2023, 08:43:40 AM
@marco
Marco grazie ...

questa sera gli do un occhiata
(I'll take a look at it tonight)

ciao