<?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: Cycling through folders in a directory in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618957#M81834</link>
    <description>&lt;P&gt;Thanks for the tips!&lt;/P&gt;</description>
    <pubDate>Sat, 01 Apr 2023 03:35:02 GMT</pubDate>
    <dc:creator>sandersjrs</dc:creator>
    <dc:date>2023-04-01T03:35:02Z</dc:date>
    <item>
      <title>Cycling through folders in a directory</title>
      <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618777#M81813</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a script that works on a set of data that my I get from a cyclic loading machine. However, I receive batches of data from this machine that is organized into folders containing the .txt file that I want to run the script on. Is there a way that I can paste the script file into the parent folder containing all of the subfolders that contain the .txt files and have it run through each folder (opening the .txt files in the folders and running the script on each .txt file as it goes)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the script set up right now to where it can return the current file path where the script is located by using &amp;lt;path 1 = Convert File Path( "" );&amp;gt;, and right now, I have to explicitly define (type out in the script) the file name to open up the data file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using JMP 17.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:07:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618777#M81813</guid>
      <dc:creator>sandersjrs</dc:creator>
      <dc:date>2023-06-09T16:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cycling through folders in a directory</title>
      <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618923#M81829</link>
      <description>&lt;P&gt;The&amp;nbsp;Multiple File Import() function is a fantastic shortcut for this, as it returns a list of files. I'd suggest doing the import via the GUI first, then just copying the script and modifying it as necessary. Pseudo-script below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;m = Multiple File Import (lots of settings);
lstFiles = m &amp;lt;&amp;lt; import data;
for each ({filename}, lstFiles,
    //your script for each file
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Mar 2023 20:57:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618923#M81829</guid>
      <dc:creator>Jed_Campbell</dc:creator>
      <dc:date>2023-03-31T20:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cycling through folders in a directory</title>
      <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618932#M81830</link>
      <description>&lt;P&gt;And if MFI doesn't do what you need, FilesInDirectory(...) returns a list of files and directories. The isFile() and isDirectory() and FileCreationDate() and FileModificationDate() may help you get what you need. (approximate names, check the scripting index.) I &lt;EM&gt;think&lt;/EM&gt; FilesInDirectory does &lt;EM&gt;not&lt;/EM&gt; return directories when the &lt;EM&gt;recursive&lt;/EM&gt; option is used. There may be items in the list that are not files or directories, so use the test that makes the most sense. But if MFI will do it, you'll have a simpler JSL script.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 21:50:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618932#M81830</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-03-31T21:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cycling through folders in a directory</title>
      <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618956#M81833</link>
      <description>&lt;P&gt;Thanks for the response - will try soon!&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 03:34:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618956#M81833</guid>
      <dc:creator>sandersjrs</dc:creator>
      <dc:date>2023-04-01T03:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cycling through folders in a directory</title>
      <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618957#M81834</link>
      <description>&lt;P&gt;Thanks for the tips!&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2023 03:35:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/618957#M81834</guid>
      <dc:creator>sandersjrs</dc:creator>
      <dc:date>2023-04-01T03:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cycling through folders in a directory</title>
      <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/619621#M81907</link>
      <description>&lt;P&gt;Jed,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like the multiple file import data is working, however, I cannot get the "for each" function to work. It seems like it is not iterating through the list of files created with Multiple File import - I am getting the same return value from my script 33 times (33 is the number of items in the list of files).&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 16:17:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/619621#M81907</guid>
      <dc:creator>sandersjrs</dc:creator>
      <dc:date>2023-04-03T16:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cycling through folders in a directory</title>
      <link>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/619627#M81910</link>
      <description>&lt;P&gt;to expand &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/610"&gt;@Jed_Campbell&lt;/a&gt;&amp;nbsp; example a bit,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;for each ({filename}, lstFiles,
    //your script for each file
    dt = filename; // it isn't really a name, it is a data table handle
    ... do something with this open data table that dt points to
    close( dt, "nosave" ); // if you are done with it
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Copying filename to dt is just to make it clear what the list element is. You might dt&amp;lt;&amp;lt;graphbuilder(...), etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Apr 2023 17:11:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Cycling-through-folders-in-a-directory/m-p/619627#M81910</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-04-03T17:11:23Z</dc:date>
    </item>
  </channel>
</rss>

