Script would be the best option for that.Have a look in the help file or do a search on this forum for scripts.What your asking for is a very common question.

Registered forum members do not see this ad.
does anyone know of a lisp or any other method that can be used to purge multiple drawings without opening each one and individually purging them? or, is there a lisp that can be written that will purge all once a file is closed? there are about 20,000 files i'm working with at work right now, and i desperately do not want to open all of these drawings.
i'm running both 2002 and R14.
thanks.



Script would be the best option for that.Have a look in the help file or do a search on this forum for scripts.What your asking for is a very common question.

yeah, i see alot of similar questions, but i have two problems,
1. i believe that if you want to modify multiple drawings at once you must either use some sort of batch process, or MDE(MDI), but i have no idea where to start with that using lisp or otherwise.
2. i cannot find a code that purges and saves documents. i'm a novice at lisp, having only really written one short code that works for page setups, and i'm not sure exactly how i even got it to work. i've been using autocad for years, but only on a basic draw and edit type level.
any help would be greatly appreciated.
I do not know why most of CAD user name a SCRIP to be a LISP
SCRIPT is a text file where you put one by one the same keystroke you would do at the keyboard to do same task.
Just to test it .
copy it and paste on your notepad and save it with this nameCode:line 0,0 1,1
Now from the command line typemy-first-script.scr
at the dialogbox select my-first-script.scrSCRIPT
and you will see a line from 0,0 to 1,1
Geez....20,000 drawing filesWithout knowing if there is a third-party software out there for this that can do it without opening each drawing, a batch file calling a purge script is your best bet. Start it on a computer no one uses or start it on your own when you leave ( be sure to test before! ). If you know the folders, you can hard code them into the batch file. My example batch file will need to reside in the same folder as the drawings you want to run it on.
Here is the basic batch file that will open AutoCAD, open a drawing, run the script, close AutoCAD, open AutoCAD, open the next drawing, etc...
Copy the code, paste into Notepad, put your paths to your acad.exe and to the purge.scr (which is listed further down), and save as Purge.bat
Purge.bat
Code:FOR %%V IN (*.DWG) DO START /W "c" "C:\***PUTPATHHERE***\acad.exe" %%V /nologo /b "C:\***PUTPATHHERE***\Purge.scr" FOR %%V IN (*.BAK) DO DEL %%V
Copy the code, paste into Notepad, hit enter to put a blank line at the end and save as Purge.scr
Purge.scr
Now put a copy of Purge.bat into the folder with your drawings, double click it, and the rest is history! (make sure you test it before you go home!)Code:PURGE ALL * NO PURGE ALL * NO PURGE ALL * NO ****MAKE SURE YOU HAVE A BLANK LINE HERE (JUST HIT ENTER AFTER YOU PASTE INTO NOTEPAD****
EDIT: I FORGOT TO ADD SAVE AND QUIT....I'LL TAKE CARE OF THAT...SORRY...
AutoCAD 2005
ADT 2005

excellent. thank you very, very much. i was making some headway using lisp file, i just could not figure out how to run my lisp on multiple files...
this script coding seems like the answer then. looks like i have another language to learn. yipee.
i will look for the save and quit functions online, but i will probably not be that successful, so i anxiously await your reply.
again, thank you.
marcus
Final script:
Code:PURGE ALL * NO PURGE ALL * NO PURGE ALL * NO ZOOM EXTENTS QSAVE QUIT NO ****BLANK LINE HERE****
AutoCAD 2005
ADT 2005
Scripts aren't another language...just typewriter...anything you can do at the command line, a script file can do. A script file acts like you're sitting there typing in each command, except a lot faster than you can!Originally Posted by msstrang
AutoCAD 2005
ADT 2005

i see, that is good to know.
i got the program working. for some reason the script you provided didn't work at first (even with the blank line at the bottom) but i got it working using hurricane script generator. i appreciate all the help.
there is only one final issue. in folders where there are multiple drawings (20+) the process seems to hang up from time to time and get stuck in a file. is that typical with this type of .bat & .scr function, or is there something i might be able to do to fix it?
Registered forum members do not see this ad.
A bit off subject, but the code below is a lisp routine that I use to save every time I exit a drawing.
cs meant "clean save" and I set the routine to run 4 times to make sure that it cleaned out all extraneous layers, styles, etc.Code:(defun c:cs () (command "_layer"(command "make"(command "0"))) (command "_purge"(command "a"(command "*"(command "n")))) (command "_purge"(command "a"(command "*"(command "n")))) (command "_purge"(command "a"(command "*"(command "n")))) (command "_purge"(command "a"(command "*"(command "n")))) (command "qsave") )
Tony Eeds aka Teeds aka Dad aka Grandpa
Proud member of the Peanut Gallery and the Pajama Economy
AutoCAD 2007 - 2008 arrived, and I just got an email that 2009 has shipped
Originally Posted by Teeds
Bookmarks