<?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>Question Re: Parse file name and path from full path in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/parse-file-name-and-path-from-full-path/qaa-p/13823849#M4854692</link>
    <description>&lt;P&gt;Wow, was just about to post something comparable but had to lookup the third LOCATE() parameter, as usual:)&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2016 11:46:18 GMT</pubDate>
    <dc:creator>VolkerBarth</dc:creator>
    <dc:date>2016-01-18T11:46:18Z</dc:date>
    <item>
      <title>Parse file name and path from full path</title>
      <link>https://community.sap.com/t5/technology-q-a/parse-file-name-and-path-from-full-path/qaq-p/13823847</link>
      <description>&lt;P&gt;This is how I do it today, but I suspect there are better ways to do it?&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;BEGIN

declare ls_path nvarchar(200);

set ls_path = 'C:\\tempfolder\\test\\testfile.txt';

select 
    left(ls_path, len(ls_path) -len(row_value) ) cc_path, row_value cc_filename
from 
    sa_split_list(ls_path, '\\')
where 
    row_value &amp;lt;&amp;gt; '' and
    line_num = (select max(line_num) from sa_split_list(ls_path, '\\') );

END&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 18 Jan 2016 11:20:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/parse-file-name-and-path-from-full-path/qaq-p/13823847</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-01-18T11:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Parse file name and path from full path</title>
      <link>https://community.sap.com/t5/technology-q-a/parse-file-name-and-path-from-full-path/qaa-p/13823848#M4854691</link>
      <description>&lt;P&gt;I would think it is easier to use locate( ..., '\\\\', -1 ) to find the last backslash and then split the string at that location.&lt;/P&gt;
&lt;LI-CODE lang="sql"&gt;begin
  declare @path varchar(255) = 'c:\\\\my\\\\path\\\\name\\\\filename.jpg';
  select locate( @path, '\\\\', -1 ) as len,
         left( @path, len-1 ) as path,
         substr( @path, len+1 ) as filename;
end;&lt;/LI-CODE&gt;


&lt;P&gt;Note that backslashes should be doubled ... otherwise sequences like \\n will get interpreted as newline (similar for \\r and \\t and a few others)&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2016 11:44:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/parse-file-name-and-path-from-full-path/qaa-p/13823848#M4854691</guid>
      <dc:creator>MarkCulp</dc:creator>
      <dc:date>2016-01-18T11:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Parse file name and path from full path</title>
      <link>https://community.sap.com/t5/technology-q-a/parse-file-name-and-path-from-full-path/qaa-p/13823849#M4854692</link>
      <description>&lt;P&gt;Wow, was just about to post something comparable but had to lookup the third LOCATE() parameter, as usual:)&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2016 11:46:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/parse-file-name-and-path-from-full-path/qaa-p/13823849#M4854692</guid>
      <dc:creator>VolkerBarth</dc:creator>
      <dc:date>2016-01-18T11:46:18Z</dc:date>
    </item>
  </channel>
</rss>

