jmp-l
[Top] [All Lists]

How do I get a list of files on disc into JSL?

To: jmp-l@lists.biostat.wustl.edu
Subject: How do I get a list of files on disc into JSL?
From: Kyle Hamar <kyle.hamar@gmail.com>
Date: Mon, 23 Jan 2006 16:51:49 -0800
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=b+/SFCjyXaNaPV4KyLlB2U5grD39Y2SsojNigBSitmGz779jqTBYpY5UNC7aue0KWqTFsGmWIKrzYgTpcyVe5gWI2h93McCMWG0Tfu+l/htMOqgEqsheDPBvDiVM6tme/GfKVqNieZBz9EcDbHKRgDH1MoXDgYV7Q8uQ1Jgve1g=
I would like to run a series of test on some local data files. The
scheduling part is easy (attached below.)

If all my files are in one location (ie. directory) I would like to
automate loading the list of files to be acted upon. Can this be done
in JSL? My goal is to replace the hard-coded "files = {list}" with a
routine to access a given directory and act upon every file at that
location.

How do I list files in a directory from JMP?

Kyle

================================

// With a given list of files:
files = {       "first",
                "second",
                "third",
                "fourth"};

PeriodicCheck = expr(    write("Checking Now\!r");
                                stamp = Format(today(),"yyyymmdd");
                                write(stamp||" "||Format(today(),"h:m:s")||" ");
                                write("Scheduling all tasks listed\!r");
                                schedule(5, task1);
                                schedule(10, task2);
                                //add more tasks here
                                schedule(20, PeriodicCheck)     );

task1 = expr( ); // ommitted for brevity

task2 = expr (
                        for (r=1, r<=n items(files), r++,
                                Write(r,". Working on file: "||files[r]);
                                Write("\!r"); //new line
                                );
                        write("task 2 completed at 
"||Format(today(),"h:m:s")||" \!r");
                        write("=================================\!r \!r");      
                        );
PeriodicCheck;

<Prev in Thread] Current Thread [Next in Thread>