Check date modified

I’m working on 3ds maxscript that batch converts max files to fbx. The script is suppose to check if there has been any changes in the max file, last time the script ran. If the file hasn’t changed then it would skip the process, since there’s an fbx file for it already. The way I’m doing this is by checking the date modified for the 3ds max file and fbx. If the fbx date is less than the 3ds max date then I create a new fbx. The problem is that I can’t get the fbx’s modified date from maxscript. I tried .bat file but since I don’t know much about .bat I’m kinda stuck at it. Can anyone either help me with the .bat script or suggest some other alternative. Thanx.

I’m pretty sure you can do this through maxscript. Otherwise you can always call .NET from maxscript (look at the FileInfo class).

Have you tried saving the fbx’s last modified date in the MAX file’s custom properties?

Every time your script exports a MAX file, it could store the current time\date as a custom file property in the MAX file. Then the next time your script runs, it will compare the MAX file’s last modified date to the date stored in this property.

The disadvantage with this is if the fbx file is updated by any other means other then your script, then the date stored in the property will be out of sync. But if you plan on only updating the fbx files thru this script, then it might not be that much of an issue.

Here’s how you add a custom property:

fileProperties.addProperty #custom "fbxModifyDate" localTime #date

In MaxScript:

getFileModDate @"C:	emp\blah.txt"
"10/21/2011 8:13:11 AM"

Thanx for the reply. I wanted to do this for unity pipeline, however, I did find an alternative. So now instead of checking it from max I’m checking it from unity itself which generates a log file of all the fbx files that needs to be exported and then runs max and a maxscript with it which reads the log and exports all the files.