システム/隠しファイルと隠しファイルを除いた配列としてディレクトリの内容を取得したい。 FileSystem.GetDirectories(path)
パスに含まれるすべてのファイルをFileSystem.GetFiles(path)
返します。では、システム/隠しファイルをそこから除外するにはどうすればよいですか?
3511 次
2 に答える
0
これを試してください。linqクエリを変更するか、ディレクトリ情報オブジェクトを直接使用する必要があります。
Dim root As String = "X:\"
'Take a snapshot of the folder contents
Dim dir As New System.IO.DirectoryInfo(root)
Dim fileList = dir.GetFiles("*.*", System.IO.SearchOption.AllDirectories)
' This query will produce the full path for all .txt files
' under the specified folder including subfolders.
' It orders the list according to the file name.
Dim fileQuery = From file In fileList _
Where file.Extension = ".txt" and file.Length >1645 _
Order By file.Length _
Select file
于 2013-01-15T17:08:04.597 に答える
0
私はそれが古い質問であることを知っていますが、ここに解決策があります!
FileSystem.GetFiles(path).Where(Function(file) ((file.Attributes And FileAttributes.Hidden) <> FileAttributes.Hidden) AndAlso (file.Attributes And FileAttributes.System) <> FileAttributes.System)
私はあなたが尋ねた2つのフラグに対してすべてのファイルをチェックしました。
于 2014-07-11T14:08:36.917 に答える