Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VB6: Dateisystem-Fragen

Empfohlene Antworten

Veröffentlicht

Wie kann ich mit VB6.0 alle Unterordner in einem Ordner auflisten und überprüfen, ob in diesen eine Datei mit bestimmtem Dateinamen vorhanden ist.

Die öffne ich dann und les sie aus, aber das kann ich schon. :beagolisc

Füg als Reference die: Microsoft Scripting Runtime hinzu ...

und dann schau mal hier ...

http://p2p.wrox.com/archive/vbscript/2002-07/10.asp

da findest du n bissi was wie man es answendet ansonsten google dir mal einen ...

da habe ich es auch her ...

bin ja nur ein FISI muss also nicht programmieren können

:marine

HTH

wenn Du die Referenz auf die VBS Runtime, richtig heisst das Windows Script Host Object Model ( wshom.ocx, falls Du suchen musst ), dann hab ich hier mal Q&D ein paar Zeilen aufgeschrieben mit denen Du eigendlich den passenden Ansatz finden solltest um dein Dateisystem zu durchsuchen:

Dim objfs As New FileSystemObject

Dim objFolder As Folder, objSubfolder As Folder, objFile As file

Dim strText


Private Sub Form_Load()

Set objFolder = objfs.GetFolder("C:\WINNT")

MsgBox objFolder.Name

For Each objFile In objFolder.Files

strText = strText & file.Name & vbCrLf

Next

MsgBox strText

Text = ""

For Each objSubfolder In objFolder.SubFolders

strText = strText & objSubfolder.Name & vbCrLf

Next

MsgBox strText

End Sub

Viel Spass beim weiterbasteln

Gruss

Thoralf

P.S. bin auch nur FISI :floet:

Der Q&D-Code von lakarando arbeitet nun nur auf einer Ebene. Wenn du alle Unterverzeichnisse durchsuchen möchtest, solltest du mit Rekursion arbeiten.


Dim objfs As New FileSystemObject

Dim objFolder As Folder, objSubfolder As Folder, objFile As file

Dim strText


Private Sub Form_Load()

  Set objFolder = objfs.GetFolder("C:\WINNT")

  SearchIn objFolder, "test.txt"

End Sub


Private Sub SearchIn(objFolder as Folder, strFilename as String)

  Dim objFile as file

  Dim objSubfolder as Folder


  For Each objFile In objFolder.Files

    If file.Name = strFilename Then

      'Oeffne diese Datei und lese sie aus

    End If

  Next

  For Each objSubfolder In objFolder.SubFolders

    SearchIn objSubfolder, strFilename

  Next

End Sub

UNGETESTET!

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.