Ich habe auf Stackoverflow einen Cross-Post gepostet und bekam eine Lösung .
Beachten Sie, dass das Skript im selben Verzeichnis des Beispielordners abgelegt sein muss und über die Beispielordnerstruktur wie mein Beispiel verfügt.
Ich habe eine grundlegende, unübersichtliche Erklärung in die Batchdatei eingefügt.
@echo off setlocal enabledelayedexpansion @echo This script will create an SQLite database of .wav or .aiff samples in the folder you select @echo( @echo the script must be placed in the same directory as your sample folder. @echo( @echo Columns will be populated based on the following file structure: @echo( @echo SampleFolder\Publisher\PackName\SampleCategory (i.e. Ambience)\SampleType (i.e. Rain)\Filename.wav @echo( set /p "fld=What is the name of your sample folder? " > "%fld%\SampleDb.sql" ( echo BEGIN; echo CREATE TABLE IF NOT EXISTS "Samples" ^(File TEXT NOT NULL, Publisher TEXT, Pack TEXT NOT NULL, Category TEXT, Type TEXT, Size INT^); ) for /r "%fld%" %%A in (*.aiff *.wav) do ( set "relative_path=%%~dpA" set "relative_path=!relative_path:%cd%=!" if "!relative_path:~,1!" == "\" set "relative_path=!relative_path:~1!" call :part "!relative_path!" set "File=%%~nxA" set "File='!File:'=''!'" >> "%fld%\SampleDb.sql" echo INSERT OR REPLACE INTO "Samples" VALUES ^(!File!, !Publisher!, !Pack!, !Category!, !Type!, %%~zA^); @echo !File!, !Publisher!, !Pack!, !Category!, !Type!, %%~zA ) >> "%fld%\SampleDb.sql" echo COMMIT; sqlite3 -cmd ".read '%fld%\SampleDb.sql'" "%fld%\SampleDb.sqlite" "" pause exit /b :part for /f "tokens=2-5 delims=\" %%A in ("%~1") do ( set "Publisher=%%~A" if defined Publisher ( set "Publisher='!Publisher:'=''!'" ) else set "Publisher=NULL" set "Pack=%%~B" if defined Pack ( set "Pack='!Pack:'=''!'" ) else "Pack=''" set "Category=%%~C" if defined Category ( set "Category='!Category:'=''!'" ) else set "Category=NULL" set "Type=%%~D" if defined Type ( set "Type='!Type:'=''!'" ) else set "Type=NULL" ) exit /b