Notifications
Clear all
[Closed] Loop through files in directory
Jul 14, 2010 4:56 pm
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
Jul 14, 2010 4:56 pm
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
)