Filter hidden files

4 posts, 0 answers
  1. David Brenchley
    David  Brenchley avatar
    67 posts
    Member since:
    Jun 2010

    Posted 18 Jun 2010 Link to this post

    I want to be able to display only files that are not set to hidden by the OS.

    How do I filter files that are hidden?  I'm using the filter example, but it looks like there is no attribute or property of Hidden.

  2. Dobromir
    Dobromir avatar
    1633 posts

    Posted 22 Jun 2010 Link to this post

    Hi David,

    In order to filter the hidden files, the ResolveDirectory() method should be overriden. You can check the attributes of a file using FileInfo Class, e.g:
    public override DirectoryItem ResolveDirectory(string path)
        // Update all file items with the additional information (date, owner)
        DirectoryItem oldItem = base.ResolveDirectory(path);
        List<FileItem> visibleFiles = new List<FileItem>();
        foreach (FileItem fileItem in oldItem.Files)
            // Get the information from the physical file
            FileInfo fInfo = new FileInfo(Context.Server.MapPath(VirtualPathUtility.AppendTrailingSlash(oldItem.Path) + fileItem.Name));
            if ((fInfo.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
        DirectoryItem result = new DirectoryItem(oldItem.Name, oldItem.Location, oldItem.FullPath, oldItem.Tag, oldItem.Permissions, visibleFiles.ToArray(), oldItem.Directories);
        return result;

    I hope this helps.

    Kind regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Paul
    Paul avatar
    28 posts
    Member since:
    May 2016

    Posted 01 Sep 2016 in reply to Dobromir Link to this post

    I know this was form years ago but i get a System.StackOverflowException at -

    DirectoryItem oldItem = base.ResolveDirectory(path);


    any ideas?

  4. Vessy
    Vessy avatar
    1640 posts

    Posted 01 Sep 2016 Link to this post

    Hi Paul,

    Can you provide a little more details on the exact scenario in which the issue occurs? Are you implementing a FileSystem or FileBrowser content provider? Would it be possible to send us an isolated version of your code, so we can examine the problematic behavior and configuration on our side?

    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top