I am aware of the MOVEBAK Express Tool that can be used to create a folder into which all AutoCAD .bak files are saved. I would like know if it is possible to isolate each project's .bak files within a project's subfolder called "projectname\BAK\". Can this be done? Does anyone have some type of code that can do this? Or would a redefined SAVE command be the solution? TIA - Gary Lafrenière CAD Manager Plan B Retail Design Remove NO SPAM from address before replying
This is a post from imhuge999 (Mechanical) Jun 18, 2004 in a mechanical discussion forum: The MOVEBAK command is not compatible with autolisp in a command but there is a way around it. From Autodesk's site: The following example runs the MOVEBAK command from the AutoCAD Express Tools and sets the directory. (defun S::STARTUP ( ) (setq scrfile (open "c:\\temp\\mb.scr" "w")) (setvar "filedia" 0) (setvar "cmddia" 0) (write-line "movebak" scrfile) (write-line "c:/temp" scrfile) (write-line "filedia 1" scrfile) (write-line "cmddia 1" scrfile) (close scrfile) (command "script" "c:\\temp\\mb.scr") (princ) ) Hope that helps. If you have a file administrator/cad manager, or even want to appoint someone per project you could create a .bat file to move *.bak to a specified directory. Good luck, D
Give this a whirl. (defun movebaks (a b / dir baks bakdir) (vl-load-com) ;;; Specify the folder where the bak files are at here (setq dir "c:\\") (setq baks (vl-directory-files dir "*.bak" 1)) (setq bakdir (strcat dir "baks")) (if (not (findfile bakdir)) (vl-mkdir bakdir) ) (foreach n baks (vl-file-copy (strcat dir n) (strcat bakdir "\\" n)) (vl-file-delete (strcat dir n)) ) (princ) ) ;;; This will fire when a drawing is saved (vlr-dwg-reactor nil '(VLR-beginSave . movebaks)))
I want to give this a whirl. What must I do? Copy and paste the code into Notepad? Then, what should the filename be? movebaks.vlx? I was hoping that this file could be loaded everytime a new drawing is opened and that the current drawing's folder could be detected automatically. But it appears that a different folder name has to be manually added to the code for each project, is that correct? If my "bak" file directory name is "C:\Projects\Projectname\BAK", please show where it would be added in the code. I assume the directory name goes in between the backslashes in line (setq dir "c:\\)? Do I add this file to the Startup Suite? Thank you,
Paste it into notepad, save the file as acaddoc.lsp in your autocad install folder. This routine will work when you save a drawing. The bak file location is in the code. Currently it puts it in the "c:\\baks" folder. This line from the code sets the folder (in this case, c:\). You can change this to whatever you want. (setq dir "c:\\") This line from the code combines the previous folder name, and adds the subfolder name "baks". You can also call this folder whatever you want. (setq bakdir (strcat dir "baks"))