EpLibrary.cs.FolderHelper.GetPathOnly C# (CSharp) Method

GetPathOnly() public static method

Return only the directory of given file path with file name
public static GetPathOnly ( String filePath ) : String
filePath String the full path of the file with file name
return String
        public static String GetPathOnly(String filePath)
        {
            String retString = filePath;
            int strLength = retString.Length;

            for (int stringTrav = strLength - 1; stringTrav >= 0; stringTrav--)
            {
                if (retString[stringTrav].CompareTo('\\')!=0)
                    retString=retString.Remove(stringTrav, 1);
                else
                    return retString;
            }
            return retString;
        }