public static string GetFileName( string filePath ) { if ( filePath.EndsWith( @"/" ) ) throw new Exception( "Invalid argument for function:GetFileName" ); int idx = filePath.LastIndexOf( '/' ); return filePath.Substring( idx + 1 ); }