Delete only hidden files in folder

Hi @jadbenn
For each folder you want to check, have a for each loop to return all the files in the directory, for example: ForEach item in Directory.GetFiles(“Path\To\Folder”)
Then for each item, assign it to a new variable of type FileInfo.
Once you have done this you can use the following line to find out if that particular file is hidden or not:
FileInfoVar.Attributes.HasFlag(FileAttributes.Hidden).ToString

Hope this helps!

2 Likes