<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: go through each zip folder to get list of files name from it and save in a single table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440861#M68930</link>
    <description>&lt;P&gt;Here is a simple script that I threw together, using previous Community entries that dealt with zip files.&amp;nbsp; See if it works for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
directory = Pick Directory( "Select Directory that contains the Zip files" );
folders = Files In Directory( directory );

dt = New Table( "Zip Files",
	New Column( "Folder Name", character ),
	New Column( "File Name", character )
);


For( i = 1, i &amp;lt;= N Items( folders ), i++,
	If( Word( -1, folders[i], "." ) == "zip",
		theFolder = Open( directory || folders[i], zip );
		dirList = theFolder &amp;lt;&amp;lt; dir;
		For( k = 1, k &amp;lt;= N Items( dirList ), k++,
			dt &amp;lt;&amp;lt; add rows( 1 );
			numRows = N Rows( dt );
			dt:Folder Name[numRows] = folders[i];
			dt:File Name[numRows] = dirList[k];
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 30 Nov 2021 17:04:14 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-11-30T17:04:14Z</dc:date>
    <item>
      <title>go through each zip folder to get list of files name from it and save in a single table</title>
      <link>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440790#M68925</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I need some help here. I tried to write the jsl but I got stuck and hope someone can guide me here.&lt;/P&gt;
&lt;P&gt;I have a directory that contain 10000+ zipped folders. Each zipped folder has 100+ files.&lt;/P&gt;
&lt;P&gt;I want to do task below without unzip WITHOUT UNZIP the zipped folders.&lt;BR /&gt;1) get the name of each zipped folder.&lt;/P&gt;
&lt;P&gt;2) get into individual zipped folder.&lt;/P&gt;
&lt;P&gt;3) get the files in the zipped folder.&lt;/P&gt;
&lt;P&gt;4) in a table, add the zipped folder name in column 1 and its files name in column 2.&lt;/P&gt;
&lt;P&gt;5) repeat step 1)-4) for the next zipped folder until all done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:41:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440790#M68925</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2023-06-10T23:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: go through each zip folder to get list of files name from it and save in a single table</title>
      <link>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440840#M68928</link>
      <description>&lt;P&gt;Check out fairly new Uncharted blog post &lt;A href="https://community.jmp.com/t5/Uncharted/MFI-from-Selected-CSVs-in-a-ZIP/ba-p/439274" target="_blank" rel="noopener"&gt;MFI from Selected CSVs in a ZIP&lt;/A&gt; . It might give some quite good ideas how to approach this.&lt;/P&gt;
&lt;P&gt;Scripting Index seems to have also documentation on ZipArchive:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1638289510815.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/38020iCC52C46838B5DA22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1638289510815.png" alt="jthi_1-1638289510815.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 16:25:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440840#M68928</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-11-30T16:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: go through each zip folder to get list of files name from it and save in a single table</title>
      <link>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440861#M68930</link>
      <description>&lt;P&gt;Here is a simple script that I threw together, using previous Community entries that dealt with zip files.&amp;nbsp; See if it works for you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
directory = Pick Directory( "Select Directory that contains the Zip files" );
folders = Files In Directory( directory );

dt = New Table( "Zip Files",
	New Column( "Folder Name", character ),
	New Column( "File Name", character )
);


For( i = 1, i &amp;lt;= N Items( folders ), i++,
	If( Word( -1, folders[i], "." ) == "zip",
		theFolder = Open( directory || folders[i], zip );
		dirList = theFolder &amp;lt;&amp;lt; dir;
		For( k = 1, k &amp;lt;= N Items( dirList ), k++,
			dt &amp;lt;&amp;lt; add rows( 1 );
			numRows = N Rows( dt );
			dt:Folder Name[numRows] = folders[i];
			dt:File Name[numRows] = dirList[k];
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Nov 2021 17:04:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440861#M68930</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-11-30T17:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: go through each zip folder to get list of files name from it and save in a single table</title>
      <link>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440862#M68931</link>
      <description>&lt;P&gt;This code might get you started:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

myFolder = PickDirectory("Pick Folder", "$DESKTOP");
zipList = FilesInDirectory(myFolder);

col1Vals = {};
col2Vals = {};
for(z=1, z&amp;lt;=NItems(zipList), z++,
	filePath = myFolder||"/"||zipList[z];
	thisZIP = Open(filePath, zip);
	filesInThisZIP = thisZIP &amp;lt;&amp;lt; dir;
	for(f=2, f&amp;lt;=NItems(filesInThisZIP), f++,
		if(NItems(Words(filesInThisZIP[f], "/")) == 2,
			InsertInto(col1Vals, zipList[z]);
			InsertInto(col2vals, filesInThisZIP[f]);
			);
		);
	Close(thisZIP, noSave);
	);

NewTable("Folder of ZIP Files",
	NewColumn("Folder Name", Character, Values(col1Vals)),
	NewColumn("File Name", Character, Values(col2Vals))
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Nov 2021 17:04:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/440862#M68931</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2021-11-30T17:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: go through each zip folder to get list of files name from it and save in a single table</title>
      <link>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/441297#M68966</link>
      <description>&lt;P&gt;&amp;nbsp;Hi, I able to get the list of filenames. I want to add the step open file that contains specific string from each zipped folder and later concate all into one table. I modified the script as below, but it dont seems opening those files (there are totally 6000+ of it). the 6000+ files that the filename contain "rag" are ".log" type file.&lt;BR /&gt;is there a way I can keep append the file into the same table without having open all 6000+ files then only concate?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;path ="C:\Users\Desktop\test\";&lt;/P&gt;
&lt;P&gt;folders = Files In Directory( path );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;tables={};&lt;/P&gt;
&lt;P&gt;For( i = 1, i &amp;lt;= N Items( folders ), i++,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; If( Word( -1, folders[i], "." ) == "zip",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; theFolder = Open( path || folders[i], zip );&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; dirList = theFolder &amp;lt;&amp;lt; dir;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For( k = 1, k &amp;lt;= N Items( dirList ), k++,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If (contains(dirlist[i], "rag"),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rag_file = theFolder &amp;lt;&amp;lt; read(dirList[i], format(blob));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Open(path || folders[i] ||"\" || rag_file);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Insert Into(tables, data table(path || folders[i]));&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;);&lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dt = New Table ("all_rag_files");&lt;/P&gt;
&lt;P&gt;dt &amp;lt;&amp;lt; concatenate(tables, append to first table( 1 ), create source column);&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 19:46:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/go-through-each-zip-folder-to-get-list-of-files-name-from-it-and/m-p/441297#M68966</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2021-12-01T19:46:45Z</dc:date>
    </item>
  </channel>
</rss>

