Search This Blog

Thursday, December 09, 2004

An Easy way to update Users Local files

Do you want to always ensure that your users have the same custom files available for use in AutoCAD? An easy way to do this is to create a "seed file" folder on your network and then copy the following snippet of code into their acad.lsp file. Keep the acad.lsp file on the network and point each user to it and you can keep all your users up to date.


Assumption for this example:



  • Custom lisp files needed by all users are available
    at the following location: x:\custom\lisp

  • Users will need the files in the following
    location: c:\custom\lisp



;;; Check the following directory for standard seed files for users
;;; If they are not resident then copy them over.


(setq SeedFiles "x:\\custom\\lisp" )
(setq RootUser "c:\\custom\\lisp")


;;;Use the foreach to cycle through each file found and check for a local copy
;;;If not found then copy it over and report...
(foreach n
(vl-directory-files SeedFiles nil 1)
(if (/=
(vl-file-systime (strcat RootUser "\\" n)
)
nil)
(princ)
(progn (vl-file-copy
(strcat SeedFiles "\\" n)
(strcat RootUser "\\" n)
) ;copy file
(prompt
(strcat "\nCopying " n " to User Personal folder on " RootUser)
)
);end progn file copy
);end for each
);end macro
(princ)

Hope that was helpful.