Jump to content

Cleaning up the junk in temp directory


BIGAL

Recommended Posts

When you run cad it creates a lot of temporary files, these being saved in a directory that you can reset. The type of files are SV$ BAK DWL DCL and so on. You may be horrified how much stuff is in there. You will find the files by Options, Files, Temporary prefix (Bricscad) similar Acad.

 

When running dcl's if you crash program a lot of ~00123.dcl will be created.

 

So this will identify how many files you have, dont tick the boxes on, go have a look at the location. Move/copy anything you think you need else tick the file type box and they will be removed.

 

; clean up temp directory..

(defun cleanuptemp ( / files1 files2 files3 files4 files5 files6 files7 lst7 x val ans)
(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))
(setq pre (vla-get-TempFilePath *files*))
(alert (strcat "Your temp directory is " pre))

(setq lst7 '())

(setq files1 (vl-directory-files pre "*.BAK"))
(if (= files1 nil)
  (setq lst7 (cons "0 BAK's " lst7))
  (setq lst7 (cons (strcat  (rtos (length files1) 2 0) " BAK's ") lst7))
)

(setq files2 (vl-directory-files pre "*.sv$"))
(if (= files2 nil)
  (setq lst7 (cons "0 SV$'s " lst7))
  (setq lst7 (cons (strcat (rtos (length files2) 2 0) " SV$'s " ) lst7))
)

(setq files3 (vl-directory-files pre "*.dwl*"))
(if (= files3 nil)
  (setq lst7 (cons "0 DWL's " lst7))
  (setq lst7 (cons (strcat  (rtos (length files3) 2 0) " DWL's ") lst7))
)

(setq files4 (vl-directory-files pre "*.AC$"))
(if (= files4 nil)
  (setq lst7 (cons "0 ac$'s " lst7))
  (setq lst7 (cons (strcat (rtos (length files4) 2 0) " AC$'s " ) lst7))
)

(setq files5 (vl-directory-files pre "*.log"))
(if (= files5 nil)
  (setq lst7 (cons "0 Logfile's" lst7))
  (setq lst7 (cons (strcat (rtos (length files5) 2 0) " Logfile's ") lst7))
)
(setq files6 (vl-directory-files pre "~*.dcl"))
(if (= files6 nil)
(setq lst7 (cons "0 Temp DCL's " lst7))
(setq lst7 (cons (strcat (rtos (length files6) 2 0)" Temp DCL's " ) lst7))
)

(setq files7 (vl-directory-files pre "*.dmp"))
(if (= files7 nil)
  (setq lst7 (cons "0 DMP's " lst7))
  (setq lst7 (cons (strcat (rtos (length files7) 2 0)" DMP's " ) lst7))
)

(setq lst7 (reverse lst7))

(if (not AH:Toggs)(load "Multiple toggles.lsp"))

(setq lst7 (cons "Pick to delete " lst7))

(setq ans (reverse  (ah:toggs lst7)))

(setq x 1)
(foreach val ans
  (if (= val "1")
  (progn
    (foreach filename (eval (read (strcat "files" (rtos x 2 0))))
    (vl-file-delete (strcat pre filename))
    (princ (strcat "\n" filename))
   )
  )
  )
(setq x (1+ x))
)
(princ)
)
(cleanuptemp)

image.png.95a9a51bc3f2c4aaab3720ad0b7a6573.png

 

Multi toggles.lsp

 

Edited by BIGAL
added image
  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Slight typo maybe? In files 4:

 

(setq lst7 (cons (strcat str (rtos (length files4) 2 0) " AC$'s " ) lst7))

 

 should be

 

(setq lst7 (cons (strcat (rtos (length files4) 2 0) " AC$'s " ) lst7))

 

without the 'str'

 

 

 

.. my PC was cleaned out 10 days ago and I only have 50 temp files created since then

Edited by Steven P
Link to comment
Share on other sites

Thanks for the suggestion it uses my library function for the toggles dcl so that part can be used in any code, yes could add a select all as the return result is a list of ("1" "0" "1" "1" "1" "1") so could do check for "select all" button is on. Not sure about "unselect" will check Cancel is working properly. As the buttons are toggles if you click again they turn off.

 

You could make the changes pretty easy. You can use (set_tile "tb1" "1") and so on, so the default buttons are turned on then just press OK. A all "on" would use   (set_tile keynum "1") in multi toggles.lsp

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...