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 am looking for an easy way to do this. I have got 100 max scene files 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:

Following 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 in theFiles 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