Notifications
Clear all

[Closed] Loop through files in directory

 em3

Hi, I a script hacked together to clean up some autocad drawings I have imported into 3ds max. I have 600 max files that I now need to clean up. I am trying to loop through the files and can except I am not quite sure how to open/save/close them despite my best effort to understand the help files.


  dirName = "C:\\Documents and Settings\\david.tyner\\My Documents\\3dsMaxDesign\\scenes
  for f in (getFiles (dirName+"\\*.max")) do
 
 open file
 
 run my script
 
 save file
 
 close file
 
 

Can anyone help me fill in the blanks there?

Thanks!

2 Replies

dirName = @"C:\YOUR\PATH\HERE"
 dirFiles = getFiles (dirName+"\\*.max")
 
 for f in dirFiles do
 (
    	loadMaxFile f
    	fileIn @"C:\YOUR\MAXSCRIPT.ms"
    	saveMaxFile f quiet:true
    	resetMaxFile #noPrompt 
 )
 em3

works awesome, thanks so much thedour!