cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • We’re improving the Learn JMP page, and want your feedback! Take the survey
Choose Language Hide Translation Bar

Files In Directory

With JMP 17, the Files in Directory script command appears not to work if there are leading numbers, or numbers in the file name.  The Watch window returns various errors unless all file names are number free.

 

<jsl> folderPath = "C:\Users\first.last\documents";

<jsl> fd = Files In Directory( folderPath,1,1 );
<jsl> w = Watch ( fd );

 

Is this fixed in a different release?  Suggestions?

3 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Files In Directory

It looks to be an issue with the way the Watch window displays the variables.  The variable "fs" is properly defined.  No issues appeared until I added the "05 Messages.xls" file.  I would just avoid the Watch() function.  Show() works in any situation, as far as I can tell.

 

Names Default to Here( 1 );
dir = "$DOCUMENTS\JMP Scripts\zero test\";
fs = Files in Directory( dir, 1, 1 );
w = Watch( fs );
Show( fs );
//fs = {"0 is smaller than 1", "00five-oh.txt", "0meansinfinity.txt", "Hello World.txt"};

mmarchandFSLR_1-1748899362167.png

 

 

Names Default to Here( 1 );
dir = "$DOCUMENTS\JMP Scripts\zero test\";
fs = Files in Directory( dir, 1, 1 );
w = Watch( fs );
Show( fs );
//fs = {"0 is smaller than 1", "00five-oh.txt", "05 Messages.xls", "0meansinfinity.txt", "Hello World.txt"};

mmarchandFSLR_0-1748899220959.png

 

 

View solution in original post

Re: Files In Directory

Oh, and Watch() behaves the same way in JMP 18.0.1.  I ran the test above in 17.2.

View solution in original post

hogi
Level XII

Re: Files In Directory

Besides watch in the GUI of the debugger, there is a watch() command:

I just checked some files with 0s with JMP v18.2.1:

hogi_0-1748929374452.png

 

seems that it's not the 0s, but a line break which causes the issue - after adding another file:

hogi_1-1748929519588.png

 



View solution in original post

7 REPLIES 7
jthi
Super User

Re: Files In Directory

I'm having no such issues (using JMP18 though). Is the specific reason for using Watch() instead of Show() for example?

Names Default To Here(1);

folderPath = "$DOCUMENTS";
fd = Files In Directory(folderPath, 1, 1);

show(fd);

jthi_0-1748895835228.png

 

-Jarmo
txnelson
Super User

Re: Files In Directory

I just ran the following example in JMP 17.2 running under Windows11 and had no issues with files with names starting with numbers

names default to here(1);

folderPath = "C:\Users\Jim\Documents\Discussion Groups";

fd = Files In Directory( folderPath,1,1 );
{"0123mike_s.xlsx", "34Yass_Sample_Row6.xlsx", "Chris_Liu", "ConfidenceOwl94",
"mann", "Yass_Sample_Row5.xlsx"}
Jim

Re: Files In Directory

Correction.  Seems to be leading zeroes, for example "05 Messages.xls" in the file name that cause an issue in what gets returned in the Watch window.

Re: Files In Directory

It looks to be an issue with the way the Watch window displays the variables.  The variable "fs" is properly defined.  No issues appeared until I added the "05 Messages.xls" file.  I would just avoid the Watch() function.  Show() works in any situation, as far as I can tell.

 

Names Default to Here( 1 );
dir = "$DOCUMENTS\JMP Scripts\zero test\";
fs = Files in Directory( dir, 1, 1 );
w = Watch( fs );
Show( fs );
//fs = {"0 is smaller than 1", "00five-oh.txt", "0meansinfinity.txt", "Hello World.txt"};

mmarchandFSLR_1-1748899362167.png

 

 

Names Default to Here( 1 );
dir = "$DOCUMENTS\JMP Scripts\zero test\";
fs = Files in Directory( dir, 1, 1 );
w = Watch( fs );
Show( fs );
//fs = {"0 is smaller than 1", "00five-oh.txt", "05 Messages.xls", "0meansinfinity.txt", "Hello World.txt"};

mmarchandFSLR_0-1748899220959.png

 

 

Re: Files In Directory

Oh, and Watch() behaves the same way in JMP 18.0.1.  I ran the test above in 17.2.

txnelson
Super User

Re: Files In Directory

I changed my file names where one file starts with "01 23mike_s.xlsx".

Running in JMP 17.2 I have no issue in my watch window

txnelson_0-1748900558844.png

 

Jim
hogi
Level XII

Re: Files In Directory

Besides watch in the GUI of the debugger, there is a watch() command:

I just checked some files with 0s with JMP v18.2.1:

hogi_0-1748929374452.png

 

seems that it's not the 0s, but a line break which causes the issue - after adding another file:

hogi_1-1748929519588.png

 



Recommended Articles