Recently, I had a requirement to extract just the directory name from a file name. The code snipped provided below does just that.
select substr(:1,1,instr(:1,:2,-1)) FROM DUAL;
where :1 is the full file name(along with the path)
:2 is the directory separator
select substr('D:\Sample\Mani.txt',1,instr('D:\Sample\Mani.txt','\',-1)) FROM DUAL;
This code would strip off the file name and return just the directory
Have fun. 🙂