Notifications
Clear all

[Closed] batch convert to previous max version ?

Hello everyone

Is anybody aware of any tools to batch convert a lot of Max files to previous max version ?
(from 2014 to 2013)

best

Jerome

3 Replies

This should work for you. Don’t know of any built in tools to do it.


(
	fDir = getSavePath caption:"Directory of Max Files" initialDir:MaxFilePath
	
	if fDir != undefined do
	(
		makeDir (fDir + "\\2013\\") all:true
		
		mFiles = getFiles (fDir + "\\*.max")
		
		for f in mFiles do
		(
			if loadMaxFile f quiet:true do
			(
				newFileName = getFilenamePath f + "2013\\" + getFilenameFile f
				saveMaxFile newFileName saveAsVersion:2013 quiet:true
			)
		)
	)
	
)

Well, to answer my own post, and in case it could help someone, I made my own script using bits of code from the help file.

WARNING : It’s untested. (I mean, I used it only once for my own conversion and it worked) – use it at your own risk and make sure you have a backup. It doesn’t perform any security check.

If any one feels like improving or correcting it, please !

(
 	
 	clearListener()
 	
 my_files = #()
 
 fn getFilesRecursive root pattern =
 	(
 	dir_array = GetDirectories (root+"/*")
 	for d in dir_array do
 	  join dir_array (GetDirectories (d+"/*"))
 
 	for f in dir_array do
 	  join my_files (getFiles (f + pattern))
 	my_files
 	)
 --get all .max files from the specified folder  --and all its subfolders:
 getFilesRecursive "E:/project/scenes/" "*.max"  -- change the folder here
 
 	-- just for checking
 	  for file in my_files do print file
 	 print my_files.count
 	  
 	  --open and save the files 
 	  for file in my_files do (
 		  
 		  loadMaxFile file
 		  saveMaxFile  file saveAsVersion:2013
 		  
 	  )
 )

Thanks a lot Juan !

We came to the same solution and posted simultaneously.

Actually, it was easier than I expected.

anyway, thanks a lot for helping !

Jerome

EDIT : Juan’s version seems to make a copy of the files, my version saves the same files. Juan’s version is safer