I have many .db sqlite3 files. Files are in separated subfolders and most of them have same file name: base.db.
Every file contains a table 'main' and I want to extract table from every .db file to separate csv file, so that every csv is extracted in the same subfolder next to .db file.
I tried with this script
cd C:\sqlite-tools-win32-x86
for /R %%G in (*.db) do sqlite3 -csv -header "%%G" "select * from main" > %%~nG.csv
The problem is, this script is reading .db files from subfolders, but extract csv's in root folder, and also overwrites previous csv file.
I hope the explanation is clear. Any idea how to fix it?