Notifications
Clear all

[Closed] Check if file exist before writing

Hi all.

I’m going to do a command to write a file, is that:

bm01 = rendermap (mix()) size:[100,100]
bm01.filename = “c:\ emp\ em_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.

4 Replies

This is directly taken from the MaxScript User Reference:

fn existFile fname = (getfiles fname).count != 0

This Function test if the specified file exists.

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

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:\ emp\ est*.tga”

and it will return true if ANY file with that pattern exists, like c: emp est.tga, c: emp est0001.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.

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!

or ‘<boolean>doesFileExist <filespec>’