How to check if a Sharepoint URL is a file or a folder.
The code uses the NormalizeUrl function.
Code
public bool IsFolder(string url) { url = NormalizeUrl(url); try { var rootFolders = _context.Web.GetFolderByServerRelativeUrl(url).Folders; _context.Load(rootFolders, folders => folders.Include(f => f.ListItemAllFields)); _context.ExecuteQuery(); return true; } catch { return false; } }