Forums > MaxMSP

file/folder distinction and iteration — oh no, not again!

August 28, 2006 | 12:08 pm

Hi all, is there a pure-Max way to check if a path name refers to a file or a
folder?

I know I could do this easily in javascript, I’ve read through the folderiter.js
example, but it seems kind of slow to me, pausing for a few seconds before
outputting the folder contents.

Cheers…
…Diemo


Diemo Schwarz, PhD — http://www.ircam.fr/anasyn/schwarz
Real-Time Applications Team — http://www.ircam.fr/equipes/temps-reel
IRCAM – Centre Pompidou — 1, place Igor-Stravinsky, 75004 Paris, France
Phone +33-1-4478-4879 — Fax +33-1-4478-1540



f.e
August 28, 2006 | 1:45 pm

I don’t think there’s a way to identify file / folder in Max, but if you
think js is too slow, you may try Java :

File f = new File (our_path)
if ( f.isDirectory()) oulet(0, bang); …

cheers

f.e

f.e chanfrault | aka | personal computer music
> >>>>>> http://www.personal-computer-music.com
> >>>>>> |sublime music for a desperate people|

Diemo Schwarz wrote:
>
> Hi all, is there a pure-Max way to check if a path name refers to a
> file or a folder?
>
> I know I could do this easily in javascript, I’ve read through the
> folderiter.js example, but it seems kind of slow to me, pausing for a
> few seconds before outputting the folder contents.
>
> Cheers…
> …Diemo
>
>


August 28, 2006 | 6:50 pm


August 29, 2006 | 4:47 pm

I use this a lot. Works fine on Mac, didn’t test in windows.

#P button 101 100 15 0;
#P button 56 100 15 0;
#P newex 101 119 41 196617 t maxb;
#P newex 56 119 34 196617 t fold;
#P newex 56 140 56 196617 opendialog;
#P toggle 56 178 15 0;
#N vpatcher 28 523 156 673;
#P window setfont "Sans Serif" 9.;
#P newex 58 83 35 196617 == 47;
#P newex 18 64 50 196617 zl ecils 1;
#P newex 18 45 40 196617 atoi;
#N comlet (bool) is folder;
#P outlet 58 102 15 0;
#N comlet (path) input;
#P inlet 18 28 15 0;
#P connect 0 0 2 0;
#P connect 2 0 3 0;
#P connect 3 1 4 0;
#P connect 4 0 1 0;
#P pop;
#P newobj 56 159 81 196617 p isFolderOrFile;
#P connect 0 0 1 0;
#P connect 2 0 0 0;
#P connect 5 0 3 0;
#P connect 3 0 2 0;
#P connect 4 0 2 0;
#P connect 6 0 4 0;

Hope that’s what you mean..
Mattijs


Viewing 4 posts - 1 through 4 (of 4 total)