Here’s a simple peoplecode snippet to get filename from given file path. The file name returned for below code is “Phani.csv”

1) For Unix File Path

&UnixFilePath = “/psoft/hr91/devbox/data/stage_in/arch/Phani.csv”;

Local Array of String  &FilePath;
   &FilePath = Split(&UnixFilePath, “/”);
   &Filename = &FilePath [&FilePath.Len];

Or

2) For Windows File Path

&WindowsFilePath =  “\\psoft\hr91\devbox\data\stage_in\arch\Phani.csv”; 

Local Array of String  &FilePath;
   &FilePath = Split(&WindowsFilePath, “\”);
   &Filename = &FilePath [&FilePath.Len];

Advertisements