cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
MPK
MPK
Level II

On Mac Big Sur JSL seems to detect a file indicating deletion of one or more files

Hi,

 

I'm puzzled by the detection of deleted files by JSL (JMP 16.0.0 on a Mac Big Sur 11.6.8).  I created a folder containing 8 files and ran the following script:

 

Names Default To Here( 1 );

TargetDir = Pick Directory();
TargetFiles = Files In Directory( TargetDir );

N_TargetFiles = N items(TargetFiles);
show(N_TargetFiles);

For( i = 1, i <= N Items( TargetFiles ), i++,
	sample = Left( TargetFiles[i], Contains( TargetFiles[i], "." ) - 1 );
	Show( sample );
);

The Log indicates 8 files were detected (see attached, first run).  Then I deleted one file in the folder and ran the script again.  The Log still indicates 8 files are present and it includes a "" to indicate that one was deleted (see attached, second run).  If I start over with 8 files and delete 6, 3 are detected, one of which is "", so maybe "" indicates a temporary file indicating files were deleted.

 

Is this a known behavior of JSL/JMP on a Mac or with Big Sur?  How can I avoid including the "" item in the count and on the list?

 

Thanks for your input.

 

Log showing detection of deleted file.png

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: On Mac Big Sur JSL seems to detect a file indicating deletion of one or more files

Sounds like a bug, perhaps in JMP. As a workaround, untested code (no Mac here):

 

x = {"a", "b", "", "c"};
Show( x );
y = Filter Each( {filename}, x, filename != "" );
Show( y );


x = {"a", "b", "", "c"};
y = {"a", "b", "c"};

 

@Audrey_Shull 

Craige

View solution in original post

3 REPLIES 3
Craige_Hales
Super User

Re: On Mac Big Sur JSL seems to detect a file indicating deletion of one or more files

Sounds like a bug, perhaps in JMP. As a workaround, untested code (no Mac here):

 

x = {"a", "b", "", "c"};
Show( x );
y = Filter Each( {filename}, x, filename != "" );
Show( y );


x = {"a", "b", "", "c"};
y = {"a", "b", "c"};

 

@Audrey_Shull 

Craige
MPK
MPK
Level II

Re: On Mac Big Sur JSL seems to detect a file indicating deletion of one or more files

Thanks very much for your help.  I discovered the mystery file is a hidden .DS_Store file that occupies a Mac directory when one or more files is deleted, which I confirmed in my directories using Terminal ls -a to reveal hidden files. I renamed the file list in my previous script, then modified your suggested syntax to filter away the .DS_Store file (see blue script below). The script counts files properly and avoids the mystery "" file.

 

The goal is to automate file processing on a selected folder containing target files. I was working through an alternative approach to select only files with the desired .txt extension, which might also exclude other "contaminating" files in a directory, but since your suggestion worked I'll likely continue with it.

 

I would call this a Mac bug rather than a JMP bug, but I suppose that's arguable.

 

Names Default To Here( 1 );


TargetDir = Pick Directory();
Files = Files In Directory( TargetDir );

TargetFiles = Filter Each( {filename}, Files, filename != ".DS_Store" );

N_TargetFiles = N Items( TargetFiles );
Show( N_TargetFiles );

For( i = 1, i <= N Items( TargetFiles ), i++,
	sample = Left( TargetFiles[i], Contains( TargetFiles[i], "." ) - 1 );
	Show( sample );
);

 

Re: On Mac Big Sur JSL seems to detect a file indicating deletion of one or more files

 Thanks for tagging me, @Craige_Hales. I can confirm that this was a bug in JMP related to the invisible .DS_Store file that appears on Mac to store history information for a folder. I can also confirm it has been addressed in JMP 17, which will be released in a couple of months. Thanks for providing the nice workaround!