[Solved] Import multiple .3ds files and save


I’m trying to write a small script that imports multiple .3ds files and saves them as max files with the same name as the 3ds file. The saving works fine but somehow the files get merged, anyone know what could be the problem with the script?

	rollout importer "Importer" width:650 height:500
		editText folderpath "Directory:" fieldWidth:300 pos:[19,25]
		button imp3ds "Import 3DS" pos:[200,110] width:100 height:19
		on imp3ds pressed do
			dirName = folderpath.text
			dirFiles = getFiles (dirName+"\\*.3ds")

			for i in dirFiles do
					orig_filename = (Getfilenamefile(i) as string)
					importFile i #noPrompt 
					print orig_filename
					importdir = (dirName+"\\")
					newFile = (importdir + orig_filename + ".max")
					saveMaxFile newFile quiet:on



		fn overwrt filename = 
			if getFilenamePath filename == "" do 
			filename = getdir #scene + "\\" + filename 
			if (not (doesfileexist filename)) or 
			querybox ("filename: "+filename + "\nexists. Overwrite?") then 
			saveMaxFile filename 

	createdialog importer pos:[500,80] 


Ugh, im so stupid. I forgot to reset the scene after saving.

resetmaxfile #noprompt

This is solved.