View Full Version : Check if file exist before writing
CerberusC 02-15-2009, 08:57 PM Hi all.
I'm going to do a command to write a file, is that:
bm01 = rendermap (mix()) size:[100,100]
bm01.filename = "c:\\temp\\tem_01.jpg"
save bm01
close bm01
But after write the file i want to check if the file exist, how can i do that?
Thanks.
|
|
Piflik
02-15-2009, 09:20 PM
This is directly taken from the MaxScript User Reference:
fn existFile fname = (getfiles fname).count != 0
This Function test if the specified file exists.
CerberusC
02-15-2009, 09:29 PM
Thanks, i'm going to check in the help, i was looking for that searching with "check" term not exist, that's why i did not found it
:)
Cheers!
ZeBoxx2
02-15-2009, 09:38 PM
or '<boolean>doesFileExist <filespec>'
This is directly taken from the MaxScript User Reference:
fn existFile fname = (getfiles fname).count != 0
This Function test if the specified file exists.
This is a left over from the Max 2.0 MAXScript Reference ;)
It still has one advantage over doesFileExist() - at allows for file name wildcard patterns, so you can say
existFile "c:\\temp\\test*.tga"
and it will return true if ANY file with that pattern exists, like c:\temp\test.tga, c:\temp\test0001.tga etc. I added a note to the MAXScript 2010 Reference regarding this to avoid confusion and cross-linked to doesFileExist() so you cannot miss it.
CGTalk Moderation
02-15-2009, 09:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.