Let's say I have the following path and base directory
string FileDirectory = "/tmp/simple";
string fullPath = "/tmp/simple/s1/s1.txt";
Then how do I find the path of s1.txt
relative to FileDirectory
without writing a loop?
ie; I want s1/s1.txt
as the output.
This looks like the inverse of the Substring operation.
Hence I did like
string relativePath = fullPath.Substring(FileDirectory.Length, (fullPath.Length - FileDirectory.Length));
Is there any existing function to achieve the same?