<?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: Extracting the File Path of a .csv File From the File Name in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62596#M33759</link>
    <description>&lt;P&gt;Think about it: you have only a file name. How would you find its location (path)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can't you ask the user who is running the script to pick the directory with the file before the script opens it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Craige pointed out, there is a default directory in JMP and you can ask about it. You can also ask about where JMP will look with &lt;STRONG&gt;Get File Search Path()&lt;/STRONG&gt;. It returns a list of paths that JMP will use to find files.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jul 2018 11:26:27 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2018-07-12T11:26:27Z</dc:date>
    <item>
      <title>RE: Extracting the File Path of a .csv File From the File Name</title>
      <link>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62593#M33756</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying to extract the file path of a csv file in order to open it. I've been using the following script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open("File.csv");

path = Arg(dt &amp;lt;&amp;lt; get property("Source"), 1);

print("path: " || path);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This prints a file not found error to the log. The file path returned shows the following:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#000000"&gt;&lt;CODE class=" language-jsl"&gt;C:\Users\jaz\Desktop\File.csv was not found.&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif" size="3"&gt;My file is&amp;nbsp;stored in a folder in the Desktop but the path does not go to&amp;nbsp;the folder. In another one of my scripts the path variable I create just provides the name of the file with a backslash. I'm confused as to why one script is providing me with a path (be it the wrong one), and another is providing the file name? &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif" size="3"&gt;Any clarification and ideas on how I could extract the full file path of the file by simply providing the name of the file would be appreciated. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif" size="3"&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif" size="3"&gt;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:25:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62593#M33756</guid>
      <dc:creator>Jaz</dc:creator>
      <dc:date>2023-06-09T23:25:18Z</dc:date>
    </item>
    <item>
      <title>RE: Extracting the File Path of a .csv File From the File Name</title>
      <link>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62594#M33757</link>
      <description>&lt;P&gt;The open statement is using the default directory. You can use the &lt;STRONG&gt;GetDefaultDirectory&lt;/STRONG&gt;() and &lt;STRONG&gt;SetDefaultDirectory&lt;/STRONG&gt;() functions to find out what path was used to try to open the file and set a path that you want JMP to use.&lt;/P&gt;
&lt;P&gt;\File.csv is suggesting the default directory is \, the root of the file system.&lt;/P&gt;
&lt;P&gt;Using the source script is a very round-about way to get the information that GetDefaultDirectory provides directly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 10:29:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62594#M33757</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-07-12T10:29:21Z</dc:date>
    </item>
    <item>
      <title>RE: Extracting the File Path of a .csv File From the File Name</title>
      <link>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62596#M33759</link>
      <description>&lt;P&gt;Think about it: you have only a file name. How would you find its location (path)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can't you ask the user who is running the script to pick the directory with the file before the script opens it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Craige pointed out, there is a default directory in JMP and you can ask about it. You can also ask about where JMP will look with &lt;STRONG&gt;Get File Search Path()&lt;/STRONG&gt;. It returns a list of paths that JMP will use to find files.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 11:26:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62596#M33759</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2018-07-12T11:26:27Z</dc:date>
    </item>
    <item>
      <title>RE: Extracting the File Path of a .csv File From the File Name</title>
      <link>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62597#M33760</link>
      <description>&lt;P&gt;I have a script in which the user basically selects&amp;nbsp;the directory and then&amp;nbsp;the csv file that they want to use. I realise now that I could just get the directory that the user selected and join that with the file name to open the file.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 12:47:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/RE-Extracting-the-File-Path-of-a-csv-File-From-the-File-Name/m-p/62597#M33760</guid>
      <dc:creator>Jaz</dc:creator>
      <dc:date>2018-07-12T12:47:14Z</dc:date>
    </item>
  </channel>
</rss>

