It seems like the StorageFile
type used when listing files in WinRT seems to have a similar Attributes
property to the FileInfo.Attributes
property found in desktop version of .NET. Its type has the same name too and is called FileAttributes
, which is an enum that has a possible value of Temporary
. It seems to be missing a Hidden
value found in .NET and if I were to venture a guess I'd say that's because hidden files are not visible and it seems to be confirmed by Mike Taulty's blog post. The search methods in WinRT don't seem to have an attributes-based filter, so you will need to either iterate through the files to check for the attribute or use something like LINQ to filter out the ones that don't match your criteria.
How to know if a file is hidden or temporary on modern/Winrt?
-
28-06-2022 - |
Question
When listing files in WinRT(C#) using something like GetFilesAsync(..) I would like to know if there is a way I could tell it to only return files that are hidden or temporary. Or when I list all the files to go through each file and check if they are hidden or temporary. You could do this in .net with FileInfo(http://msdn.microsoft.com/en-us/library/system.io.fileinfo.aspx)
Thanks
Solution
OTHER TIPS
To add to the above answer, there is no way at all, using WinRT API's, to get access to hidden files. The WinRT brokers simply won't list them or give you access to them.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow