cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
vharibal
Level III

Selecting only csv files using jsl

Hi,
I have folder with multiple folders and csv files. I would like to open only csv files and concatenate them without opening folders

I tried using Files in Directory function and opening files from folder but this opens the folders as well

Can some one please help me on this?
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Selecting only csv files using jsl

You can easily filter the list of files returned from Files in Directory, to return only .csv files

Names Default To Here( 1 );
files = Files In Directory( "C:\Program Files\JMP\JMPPRO\18\Samples\Import Data", recursive( 0 ) );
onlycsv = Filter Each( {x}, files, contains(x,".csv"));

You may also want to look into using Multiple File Import.  If your .csv files are similar MFI can automatically concatenate them for you

Names Default To Here( 1 );

mfi = Multiple File Import();
mfi << Set Folder( "$SAMPLE_IMPORT_DATA" );
mfi << Set Name Filter( "*.csv" );
mfi << Set Name Enable( 1 );
mfi << Set Stack Mode( "Stack Similar" );
mfi << Set Subfolders( 0 );
tables = mfi << Import Data();
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Selecting only csv files using jsl

You can easily filter the list of files returned from Files in Directory, to return only .csv files

Names Default To Here( 1 );
files = Files In Directory( "C:\Program Files\JMP\JMPPRO\18\Samples\Import Data", recursive( 0 ) );
onlycsv = Filter Each( {x}, files, contains(x,".csv"));

You may also want to look into using Multiple File Import.  If your .csv files are similar MFI can automatically concatenate them for you

Names Default To Here( 1 );

mfi = Multiple File Import();
mfi << Set Folder( "$SAMPLE_IMPORT_DATA" );
mfi << Set Name Filter( "*.csv" );
mfi << Set Name Enable( 1 );
mfi << Set Stack Mode( "Stack Similar" );
mfi << Set Subfolders( 0 );
tables = mfi << Import Data();
Jim
vharibal
Level III

Re: Selecting only csv files using jsl

Thank you so much.

It worked.

Recommended Articles