Better way to check for image file existance?

Jun 25, 2009 at 8:53pm

Better way to check for image file existance?

I have seen posts on the forum checking for the existence of a txt file using filein, but not for other types of files (image for me)….This is what I am currently doing. I’m using pictslider for its error outputs even though I am not using pictslider at all in the patch…seems a little cumbersome…looking for an elegant way to do this without using javascript, etc.

– Pasted Max Patch, click to expand. –
#44540
Jun 25, 2009 at 10:09pm

Have a look at the patch below. I modified an example found on the forum previously (can’t remember the original author, sorry). It takes a full file path as input and the outlet shows 1 if the file exists, 0 otherwise. If you copy it straight from the forum remember to bang the [loadmess] as [folder] looks for only text and max binary files by default. I hope it helps.

lh

– Pasted Max Patch, click to expand. –
#160215
Jun 26, 2009 at 1:50am

Yep works nicely, thanks.

#160216
Aug 5, 2011 at 11:19pm

Sorry to bring this back after a long time. I have the same problem: checking the existence of a file.
The Luke Hall’s method seems to work fine only as long as the folder exists as well. But my folders might not exist!

Does anybody know another way to check for a file existence?
And by the way: what about a [fileexists] object for the forthcoming Max 6? :-)

Thanks,
Daniele

#160217

You must be logged in to reply to this topic.