Ich glaube auch, daß die Lösung von NicTheQuick die beste ist!
So, jetzt muss ich das ganze noch mit diesem Code verbinden, damit das Programm diese Daten dann in eine sql-datenbank schreibt!
Code: Alles auswählen
Procedure.l SearchDirectory(dir$, List yourLinkedList.s(), pattern$="", recursive=1)
Static level.l=-1
If Not Right(dir$, 1) = "\"
dir$+"\"
EndIf
Protected dir.l=ExamineDirectory(#PB_Any, dir$, pattern$)
If dir
While NextDirectoryEntry(dir)
If DirectoryEntryName(dir) <> "." And DirectoryEntryName(dir) <> ".."
AddElement(yourLinkedList())
For n=CountString(dir$, "\")-level To CountString(dir$, "\")
yourLinkedList()+StringField(dir$, n, "\")+"\"
Next
yourLinkedList()+DirectoryEntryName(dir)
If DirectoryEntryType(dir) = #PB_DirectoryEntry_Directory
yourLinkedList()+"\"
EndIf
EndIf
Wend
FinishDirectory(dir)
EndIf
Protected all.l=ExamineDirectory(#PB_Any, dir$, "")
If all
While NextDirectoryEntry(all)
If DirectoryEntryType(all) = #PB_DirectoryEntry_Directory And DirectoryEntryName(all) <> "." And DirectoryEntryName(all) <> ".."
level+1
SearchDirectory(dir$+DirectoryEntryName(all)+"\", yourLinkedList(), pattern$, recursive)
level-1
EndIf
Wend
FinishDirectory(all)
EndIf
ProcedureReturn ListSize(yourLinkedList())
EndProcedure
UseSQLiteDatabase()
DatabaseFile$ = "D:\\sqlite\KaraokeSongs.sqlite"
; If CreateFile(0, DatabaseFile$)
; CloseFile(0)
; Else
; Debug "Can't create the database file !"
; End
; EndIf
If OpenDatabase(0, DatabaseFile$, "", "")
; DatabaseUpdate(0, "CREATE TABLE Songlist (IdNr INTEGER PRIMARY KEY, Pfad TEXT, Dateiname TEXT, Artist TEXT, Title TEXT, DiscID TEXT, TrackNo INTEGER)")
; Else
; Debug "Can't open database !"
; End
EndIf
path$="F:\Karaoke Songs\ALL SONGS SORTED\#mp3-wav + cdg\Code-Nr - Artist - Title\A 12\"
NewList FilesAndFolders.s()
found = SearchDirectory(path$, FilesAndFolders(), "*.mp3", 1)
ForEach FilesAndFolders()
Pfad$=path$+FilesAndFolders()
Pfad$ = ReplaceString(Pfad$, "'", "''")
FilesAndFolders() = ReplaceString(FilesAndFolders(), "'", "''")
DatabaseUpdate(0, "INSERT INTO Songlist (Pfad, Dateiname, Artist, Title, DiscID, TrackNo) VALUES ('" + Pfad$ + "', '" + FilesAndFolders() + "', '', '', '', '')")
Next
CloseDatabase(0)
Debug found
Vielleicht hat da jemand auch eine einfacherere Lösung!