Notifications
Clear all

[Closed] loop through folder, open file, export

 em3

It’s not erroring, but it’s not exporting either. Can anyone tell me where I am off here? I think it’s the openfile f part, but I am not sure.

Thanks in advance!


 dirName = "\\\swidenapp02\\g$\\Animations\\Charlotte AP1000 Animation\\MaxFiles\\ca20 40-60"
 ExDirName = "\\\swidenapp02\\g$\\Animations\\Charlotte AP1000 Animation\\MaxFiles\\ca20 40-60\\ASE"
 myPrefix="*"
 mySuffix=".max"
resetMaxFile #noPrompt
 for f in (getfiles(dirName + "\\" + "*" + mySuffix)) do
	 (
	openfile f

Objs = for o in objects collect o
	
for o in Objs do
( 
	i=1
	select o
	exportFile (ExDirName + "\\" + o.name) #noPrompt selectedOnly:true
)
)

1 Reply

You don’t have a filename suffix in your exported filename(ie: is it supposed to be exporting an obj? an fbx?), I’m guessing that’s where you’re getting hung up. Oh, just noticed, it should be loadMaxFile , not openfile