How to validate if files in a directory are or are hidden?

0

Good morning, people.

There is a program that prints PDF files that are in a predefined directory.

The problem was happening because there were two hidden files folder and the program was trying to print and burst the error as the print below:

How do I check if the file found in the folder is hidden?

    
asked by anonymous 22.03.2018 / 16:23

1 answer

0

Solved the problem with the code below. Depending on I would not have needed to create a method, but in my case it got better that way.

private Boolean IsFileHidden(string arquivo)
{
    var fileInfo = new FileInfo(arquivo);
    if (fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
    {
        return true;
    }
    return false;
}
    
22.03.2018 / 22:28