--SpaceSaver: 1.1 by zhangy
--by compress all the max file in a directory. it will save alot of space.
--1.1 have a better interface.
-- warning: using this script careful.



fn maxCompress Str_dir =
(
files = getFiles (Str_dir+"/*.max")
for f in files do (loadMAXFile f useFileUnits:true quiet:true ; saveMaxFile f)
for d in getDirectories (Str_dir+"/*") do maxCompress d
return true
)

messageBox "Make sure u have checked the Compress On Save option in Preference->Files" title:"Attention"

FileDir=getSavePath caption:"Select The Directory"
if FileDir!=Undefined do 
	(
	maxCompress FileDir
	resetMaxFile #noPrompt
	)
