How do I batch-process multiple .MAX files?

MAXScript FAQ > Working With Scene Nodes > How do I batch-process multiple .MAX files?

A user asked:

I'm just wondering if there is an easy way on doing this. Let say I've got 100 max scene file and I need to scale or move an object in each file. Is there a command to tell 3dsmax to open each file, modify that object and then save the file again?

Answer:

Here is the basic code needed to select a path, collect all max files in the specified directory, open each one and then save it again. You can include your own code in the space between the loading and the saving.

SCRIPT

thePath = getSavePath()--get a path dialog to specify the path
if thePath != undefined do--if the user did not cancel
(
  theFiles = getFiles (thePath+"\\*.max") --collect all max files in the dir.
  for f intheFiles do-- go through all of them
  (
    loadMaxFile f--load the next file
 
----------------------------------------------------------- -- MAKE SOME SCRIPTED CHANGES TO THE SCENE HERE... -----------------------------------------------------------
 
    saveMaxFile f --save the file back to disk
  )--end f loop
  resetMaxFile #noPrompt --at the end, you can reset
)--end if 

See Also