sekhar2
New Member.
234 views

Extract filename from path.

I want extract file name from path.

Example : C:\Data\Test.jpg

here file name is Test.jpg . how to extract file name ?

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

Re: Extract filename from path.

Hi,

For windows paths you could use a simple regex filter  with the value of: 

[^\\/:*?"<>|\r\n]+$

This will extract the last filename.extension even if your path contains folders with the  name similar to a filename (ex: C:\domain.ad\readme\readme.txt will yeald only readme.txt)

Regards,

Vlad

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.