Message 1 of 11

Not applicable
08-16-2019
08:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've written a short little script here. The intent was when supplied with the file directory, file extension and a list, it would create a list of all file with that extensions. For each item in that list, it would then strcat the file name with the last modified date pulled by the wonderful Lee Mac's Function and then append the combined string to the list provided.
(defun DirectoryList ( dir typ olist / filelist file new fp) (setq filelist (vl-directory-files dir typ 1)) ;get file list (foreach file filelist ;for each file in list (progn (setq ext (vl-filename-extension file)) (setq fp (strcat dir "\\" file)) (cond ((or (= ext ".dwg") (= ext ".dcl") ) (progn (setq v (rtos (LM:FileLastModified fp))) (setq new '(strcat file "|" v)) ) ) ) (setq olist (append new olist)) ) ;Adds new concat string to list. ) ) ;;-----------------=={ File Last Modified }==-----------------;; ;; ;; ;; Returns the Last Modified property of a file in Julian ;; ;; time ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; file - full filepath of file to query ;; ;;------------------------------------------------------------;; ;; Returns: Last Modified Date (Julian), else nil ;; ;;------------------------------------------------------------;; (defun LM:FileLastModified ( file / fso fObj date ) (vl-load-com) ;; © Lee Mac 2010 (setq fso (vlax-create-object "Scripting.FileSystemObject")) (cond ( (zerop (vlax-invoke fso 'FileExists file))) ( (setq fObj (vlax-invoke-method fso 'GetFile file) date (+ 2415019 (vlax-get fObj 'DateLastModified))))) (vlax-release-object fso) date )
As is, it steps though each item found, but doesn't seem to be append the list provided by the function argument.
Any ideas on how to resolve this?
Solved! Go to Solution.