Guides/Drawing standards
Batch Purge DWG Files — Remove Unused Blocks, Layers and Styles from a Whole Folder

Short answer: AutoCAD's PURGE command removes unused definitions from the drawing you have open, including nested ones if you ask it to. To purge a folder you open each file, or run PURGE through a script. A script saves the clicks but does not show you beforehand what each drawing will lose.
Received drawings often carry everything their authors ever loaded: blocks nobody inserts, layers left from an old reference, linetypes and dimension styles from a template.
This guide uses the Clean Up screen of LayerSync, part of CADXChange Toolkit. It analyses each drawing without saving anything, shows the counts and the names, and writes only when you confirm. The example is four drawings.
1. Add the drawings and read the analysis
Open LayerSync, choose Clean Up and add the drawings with Add Files… or Add Folder…. They are analysed right away and the files are not changed. The table shows for each drawing how many blocks, layers, linetypes, text styles, dimension styles, other styles and registered apps can go.
The check boxes above the table choose the categories. The ones for unused definitions are on. Zero-length lines, arcs and polylines and Empty text are off, because they delete objects from the drawing. After changing a box, click Analyze to refresh the counts.
2. Look at the names
Click Details at the right end of a row to list what would be removed, by category. Definitions that are only used by other unused ones, such as a layer used only by an unused block, are already included.
Look for things your office keeps on purpose, for example standard layers or blocks that are loaded for later use. Unused is not the same as unwanted: if you want to keep them, switch that category off.
3. Clean with a backup
Close the drawings in your CAD program, leave the backup on, click Clean Now and confirm. Each file is copied to the backup folder first; if the copy fails, the file is skipped. The cleaned file is analysed again to check that nothing selected is left. The Size column then shows each file before and after, and the line under the table the totals: here 81 objects removed and 312 KB saved on four small sample drawings. Roll Back All restores the files of this run.
4. Know what is kept
Layer 0, Defpoints and the current layer stay. So do the current linetype and styles, the Standard and Annotative styles, anything that belongs to an xref, anonymous and layout blocks, and everything still referenced. In drawings that hold plant application data, layers are not purged and the result says so.
This is a purge, not a repair. If a drawing has errors, run AUDIT on it in your CAD program.
Keep the backups until the cleaned drawings have been opened and checked. How much smaller a file gets depends on what was unused in it; some drawings shrink noticeably, others hardly at all.
CADXChange Toolkit comes with a 30-day full trial. Writing to drawings needs a licence after the trial.
Try it on your own drawings
CADXChange Toolkit does this for a whole folder of drawings, with a preview and a backup first. The 30-day trial has every feature.
Start the free trial →Before you start — common questions
- How do I purge all drawings in a folder?
- In LayerSync's Clean Up screen click Add Folder…, review the counts and details, then click Clean Now. Each drawing is backed up before it is written.
- Can I see what will be removed first?
- Yes. The analysis changes nothing on disk, and Details lists the names by category.
- Does it run AUDIT too?
- No. It removes unused definitions and, if you switch them on, zero-length objects and empty text. Use AUDIT in your CAD program for error checking.
- Do I need AutoCAD?
- No. The drawings are read and written by the Toolkit itself.