--SpaceSaver: 1.0 by zhangy
--by compress all the max file in a directory. it will save alot of space.
--init Var:u should first change this to the dir u want
-- warning: using this script careful.

FileDir="E:/temp/test"

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
)

maxCompress FileDir
resetMaxFile() #noPrompt