This is a migrated thread and some comments may be shown as answers.

Filter hidden files

3 Answers 88 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
David Brenchley
Top achievements
Rank 1
David Brenchley asked on 18 Jun 2010, 07:46 PM
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.

3 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 22 Jun 2010, 10:31 AM
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)
        {
            visibleFiles.Add(fileItem);
        }
    }
 
    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,
Dobromir
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
0
Paul
Top achievements
Rank 1
answered on 01 Sep 2016, 10:21 AM

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

DirectoryItem oldItem = base.ResolveDirectory(path);

 

any ideas?

0
Vessy
Telerik team
answered on 01 Sep 2016, 01:44 PM
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?

Regards,
Vessy
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.
Tags
FileExplorer
Asked by
David Brenchley
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Paul
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or