Hallo,
ich habe folgenden Code, welcher Dateien in einem bestimmten Ordner und dessen Unterordnern listet:
Diese Funktionen werden mit
angesteuert.
Wenn ich meinen Dokumente-Ordner durchsuchen lasse, sagt das Programm, dass es keinen Zugriff auf Eigene Bilder hat.
Kann mir jemand helfen?
ich habe folgenden Code, welcher Dateien in einem bestimmten Ordner und dessen Unterordnern listet:
VB.NET-Quellcode
- Function getallfiles(spath As String) As List(Of String)
- Try
- If spath.EndsWith("\") And spath.Length > 3 Then
- spath = spath.Substring(0, spath.Length - 1)
- print("\ removed")
- End If
- Dim oDir As New System.IO.DirectoryInfo(spath)
- Dim oFiles As System.IO.FileInfo() = oDir.GetFiles()
- Dim oFile As System.IO.FileInfo
- Dim d As New List(Of String)
- d.Clear()
- For Each oFile In oFiles
- d.Add(oFile.FullName)
- files += 1
- fls.Invoke(Sub()
- fls.Text = "Dateien: " + files.ToString
- fls.Update()
- End Sub)
- stat.Invoke(Sub()
- stat.Text = oFile.FullName
- stat.Update()
- End Sub)
- Next
- Return d
- Catch ex As Exception
- print(ex.Message)
- err.Invoke(Sub()
- errors += 1
- err.Text = "Fehler: " + errors.ToString
- err.Update()
- End Sub)
- End Try
- End Function
- Function getallfolders(spath As String) As List(Of String)
- Try
- If spath.EndsWith("\") And spath.Length > 3 Then
- spath = spath.Substring(0, spath.Length - 1)
- print("\ removed")
- End If
- Dim oDir As New System.IO.DirectoryInfo(spath)
- Dim oFiles As System.IO.DirectoryInfo() = oDir.GetDirectories()
- Dim oFile As System.IO.DirectoryInfo
- For Each oFile In oFiles
- l.Add(oFile.FullName)
- folders += 1
- fld.Invoke(Sub()
- fld.Text = "Ordner: " + folders.ToString
- fld.Update()
- End Sub)
- stat.Invoke(Sub()
- stat.Text = oFile.FullName
- stat.Update()
- End Sub)
- getallfolders(oFile.FullName)
- Next
- Return l
- Catch ex As Exception
- print(ex.Message)
- err.Invoke(Sub()
- errors += 1
- err.Text = "Fehler: " + errors.ToString
- err.Update()
- End Sub)
- End Try
- End Function
Diese Funktionen werden mit
VB.NET-Quellcode
- Function getAllSubfolders(spath As String) As List(Of String)
- l.Clear()
- errors = 0
- files = 0
- folders = 0
- Dim flist As New List(Of String)
- Dim t = Task.Factory.StartNew(Sub()
- For Each i As String In getallfolders(spath)
- For Each it As String In getallfiles(i)
- flist.Add(it)
- Next
- Next
- print(vbNewLine + "Errors: " + errors.ToString)
- End Sub)
- Return flist
- End Function
- Sub print(text As String)
- cons.Invoke(Sub()
- cons.AppendText(vbNewLine + text)
- cons.SelectionStart = cons.TextLength
- cons.SelectionLength = 0
- cons.ScrollToCaret()
- End Sub)
- End Sub
angesteuert.
Wenn ich meinen Dokumente-Ordner durchsuchen lasse, sagt das Programm, dass es keinen Zugriff auf Eigene Bilder hat.
Kann mir jemand helfen?
Ja, ja... Ich mach ja schon...
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „TimoS“ ()