<?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: Strip path: how to get a directory from a file path variable in JMP script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Strip-path-how-to-get-a-directory-from-a-file-path-variable-in/m-p/33230#M19810</link>
    <description>&lt;P&gt;here is a fairly clean pice of code that does what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;filelength = length(word(-1,emfile,"\/"));
pathlength=length(emfile)-filelength-1;
path=substr(emfile,1,pathlength);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it can be collapsed into one statement if desired&lt;/P&gt;</description>
    <pubDate>Sun, 25 Aug 2019 13:07:12 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2019-08-25T13:07:12Z</dc:date>
    <item>
      <title>Strip path: how to get a directory from a file path variable in JMP script</title>
      <link>https://community.jmp.com/t5/Discussions/Strip-path-how-to-get-a-directory-from-a-file-path-variable-in/m-p/33198#M19796</link>
      <description>&lt;P&gt;I would like to get the directory from a file path variable in my JMP script.&lt;/P&gt;&lt;P&gt;I'm opening a data file and want to save the analysis results in the same folder that the file is in.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found a clunky solution, but was hoping there was a more elegant solution for this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's my current code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Choose the directory that has the test data. 
EMfile = Pick File("Select the file containing the EM summary table.");
// The next code is a clumsy way to get the directory of EMfile, but it works. 
a = 1;
b = 1;
while (a != 0,
&amp;nbsp; b = a+1;
&amp;nbsp; a = munger(EMfile, b, "/");
);
b--;
file_dir = munger(EMfile, 0, b);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 18:57:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Strip-path-how-to-get-a-directory-from-a-file-path-variable-in/m-p/33198#M19796</guid>
      <dc:creator>jtandrews3</dc:creator>
      <dc:date>2016-12-07T18:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Strip path: how to get a directory from a file path variable in JMP script</title>
      <link>https://community.jmp.com/t5/Discussions/Strip-path-how-to-get-a-directory-from-a-file-path-variable-in/m-p/33230#M19810</link>
      <description>&lt;P&gt;here is a fairly clean pice of code that does what you want&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;filelength = length(word(-1,emfile,"\/"));
pathlength=length(emfile)-filelength-1;
path=substr(emfile,1,pathlength);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it can be collapsed into one statement if desired&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2019 13:07:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Strip-path-how-to-get-a-directory-from-a-file-path-variable-in/m-p/33230#M19810</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-08-25T13:07:12Z</dc:date>
    </item>
  </channel>
</rss>

