D
Devon_Nullman
Guest
Program to locate all 0 byte files on a drive
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.418.1.9\amd64_microsoft-windows-a..g-whatsnew.appxmain_31bf3856ad364e35_10.0.18362.329_none_cfc0b75ce2383fc7\f\new360videossquare44x44logo.targetsize-16_altform-unplated_contrast-black.png
Throws Exception "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248"
Tried Imports Alphaleonis.Win32 - from alphaleonis/AlphaFS - Full scan of my windows drive takes 4x longer using this library.
If Alphaleonis.Win32.Filesystem.File.GetSize(fName) = 0 Then
versus
If My.Computer.FileSystem.GetFileInfo(fName).Length = 0 Then
The other issue (when scanning the Windows Drive) is that while making a list of "safe: folders, sometimes System created folders are listed, but they dissappear before starting to scan files, hence the Try-Catch
Background Worker Code (after using the old John Wein code to get all "safe" folder paths):
For Each fullPath As String In safeFullPaths
Try
FolderCount += 1
For Each fname In My.Computer.FileSystem.GetFiles(fullPath,
FileIO.SearchOption.SearchTopLevelOnly, Filter)
TotalFiles += 1
If My.Computer.FileSystem.GetFileInfo(fname).Length = 0 Then
NullFileCount += 1
NullFileNames.AppendLine(fname)
End If
If BGWFiles_Folders.CancellationPending Then Exit Sub
Next
Catch ex As Exception
NullFileNames.AppendLine("***Read Error - " & fname & " - " & ex.Message)
ErrorCount += 1
If BGWFiles_Folders.CancellationPending Then Exit Sub
Continue For
End Try
If TotalFiles Mod 100 = 0 Then
BGWFiles_Folders.ReportProgress(NullFileCount)
End If
Next
Any ideas on another method to access these long paths ?
Continue reading...
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.418.1.9\amd64_microsoft-windows-a..g-whatsnew.appxmain_31bf3856ad364e35_10.0.18362.329_none_cfc0b75ce2383fc7\f\new360videossquare44x44logo.targetsize-16_altform-unplated_contrast-black.png
Throws Exception "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248"
Tried Imports Alphaleonis.Win32 - from alphaleonis/AlphaFS - Full scan of my windows drive takes 4x longer using this library.
If Alphaleonis.Win32.Filesystem.File.GetSize(fName) = 0 Then
versus
If My.Computer.FileSystem.GetFileInfo(fName).Length = 0 Then
The other issue (when scanning the Windows Drive) is that while making a list of "safe: folders, sometimes System created folders are listed, but they dissappear before starting to scan files, hence the Try-Catch
Background Worker Code (after using the old John Wein code to get all "safe" folder paths):
For Each fullPath As String In safeFullPaths
Try
FolderCount += 1
For Each fname In My.Computer.FileSystem.GetFiles(fullPath,
FileIO.SearchOption.SearchTopLevelOnly, Filter)
TotalFiles += 1
If My.Computer.FileSystem.GetFileInfo(fname).Length = 0 Then
NullFileCount += 1
NullFileNames.AppendLine(fname)
End If
If BGWFiles_Folders.CancellationPending Then Exit Sub
Next
Catch ex As Exception
NullFileNames.AppendLine("***Read Error - " & fname & " - " & ex.Message)
ErrorCount += 1
If BGWFiles_Folders.CancellationPending Then Exit Sub
Continue For
End Try
If TotalFiles Mod 100 = 0 Then
BGWFiles_Folders.ReportProgress(NullFileCount)
End If
Next
Any ideas on another method to access these long paths ?
Continue reading...