[TOOL][ICS][GB][FROYO] Extract contents of Samsung Memo App's Database to CSV File - Samsung Galaxy S (4G Model)

Many people, including myself, enjoyed using the stock Memo application on Froyo and GB. Unfortunately, it relies on TouchWiz so it is pretty unlikely that it will ever be ported to ICS. There are a plethora of note-taking apps out there to replace it, but how do you get your data back?
You don't need a running version of Memo to do this, just a backup of your Memo.db database.
I've attached a couple of shell scripts that you can run either on your phone or `nix / Mac to help you out. Here is the plan:
extract-memos.sh will take the memo data in a copy of your Memo.db, add a new table with columns for human-readable modified and created dates, as well as color, and write out the result (all memos) in a CSV file. You should be able to read the CSV file in most spreadsheet programs and save the data or transform it as you might need for another use.
Code:
[email protected]:~/Documents/memo-export$ sh extract-memos.sh
Checking database: /sdcard/memo-extract/com.sec.android.app.memo/databases/Memo.db
Checking output directory: /sdcard/memo-extract
You may want to see if there is anything important in
/sdcard/memo-extract/com.sec.android.app.memo/shared_prefs/memo_shared_pref.xml
Data exported to
/sdcard/memo-extract/memo_20120714-100915.txt
Code:
[email protected]:~/Documents/memo-export$ cat /sdcard/memo-extract/memo_20120714-100915.txt
_id,title,content,color,modify_t,create_t,color_text,modify_datetime,create_datetime
1,20120712,"A yellow memo",1,1342138985041,1342138985041,Yellow,"2012-07-12 17:23:05","2012-07-12 17:23:05"
2,20120712,"A tan memo",2,1342139010315,1342139010315,Tan,"2012-07-12 17:23:30","2012-07-12 17:23:30"
3,20120712,"A green memo",3,1342139028326,1342139028326,Green,"2012-07-12 17:23:48","2012-07-12 17:23:48"
4,20120712,"A blue memo",4,1342139045894,1342139045894,Blue,"2012-07-12 17:24:05","2012-07-12 17:24:05"
5,20120712,"A pale blue memo",5,1342139064381,1342139064381,BlueGray,"2012-07-12 17:24:24","2012-07-12 17:24:24"
extract-memos.sh expects to find the database in /sdcard/memo-extract/com.sec.android.app.memo/databases
and will write the output in /sdcard/memo-extract
If you already have a copy of Memo.db (I suggest a copy, as the script adds a new table to the database), you can adjust the input and output directories using the environment variables dbdir and outdir.
If you're not command-line savvy, you might want to try creating a copy of Memo.db using extract-files.sh first. It will try, in order:
The GB location -- /data/data/com.sec.android.app.memo
ClockworkMod backups -- /sdcard/clockworkmod/backups
TitaniumBackup backups (default location only) -- /sdcard/TitaniumBackup
and, if successful, copy/extract into /sdcard/memo-extract
You likely need busybox on your phone to run these scripts on the phone. You will need root if you intend to copy from /data/data
To run them on the phone:
Copy the scripts to your phone; here I am assuming you saved them to /sdcard/
Get a shell started on the phone (adb shell, or a terminal emulator on the phone)
Change directory to where you have the scripts
# cd /sdcard/
Uncompress the files, if you haven't already
# gunzip extract-files.sh.gz
# gunzip extract-memos.sh.gz
Get a copy of Memo.db, either using your own approach, or
# sh extract-files.sh
Assuming that succeed, extract the memos into a CSV file
# sh extract-memos.sh
Thanks to m4xm4n for pushing me to make this available. If you find it helpful, please take the time to poke both our Thanks buttons.
If you have problems, please PM me and I'll try to resolve them.
Latest version is 2012-07-14

What is the warning about memo_shared_pref.xml? I don't even have the file!
I had some reasonably useless information about "check" this and that in my com.sec.android.app.memo/shared_prefs/memo_shared_pref.xml My instance of that file dates back to the first release of the phone. I didn't see it on a fresh GB-created version, so it might be Froyo cruft, or who knows. You probably should check this file to see if there is anything useful to you in it.​
My _id values aren't all there
Missing _id values are from the memos you have deleted.​
What are _id values?
They are an internal number that the Memo app used to keep track of your memos. You probably don't need them to import.​
What are the long numbers for modify_t and create_t?
Internal "unixtime" in milliseconds. If that sounded like gibberish, use the human-readable versions that are in your local timezone.​
The create/modify times seem off by several hours
Strangely, I have some memos that seem around eight hours off in the opposite way I would expect if they were in UTC. I don't know why.​

(reserved for information on importing into other apps)
There are a ton of note-taking apps out there. Right now, I haven't found any that can import the content, the created and modified dates both, and hopefully the color in a reasonable way. If I do, I'll post here how to get the data easily into that app.

Would you be able to post a new link to extract-memos.sh? I just tried clicking on the current one, and both only led to a page that said "410 Gone."

Related

HOWTO: Backup SMS Database

Playing around with the ls -R command, I found where the SMS database is kept, and it's somewhat readable in a text editor...
UPDATE (thanks staulkor): This database is viewable, and searchable using an SQLite database viewer.
Code:
/data/data/com.android.providers/telephony/databases/mmssms.db
Just run the following command to back it up to the SD Card:
Code:
busybox cp /data/data/com.android.providers.telephony/databases/mmssms.db /sdcard
Happy hacking
You can use an SQLite viewer to read the database correctly
Would seem simple enough to write a script to run on a PC/Mac to back up the database and load it into some sort of viewer... searchable perhaps?
I'm not too familar with databases, but would seem simple enough to make a lightweight app to keep the SMS archive...
Cool, maybe we'll soon see a port of PIM Backup. Would be nice...
Hmm...
/data/data/com.android.providers/telephony/databases/mmssms.db
Click to expand...
Click to collapse
and
busybox cp /data/data/com.android.providers.telephony/databases/mmssms.db /sdcard
Click to expand...
Click to collapse
are two different paths - I think both are supposed to be
Code:
/data/data/com.android.providers.telephony/databases/
(since I can't cd to the other one).
At any rate - thanks for the tip, but can anyone else confirm this works for them? On my android (R30) I get "opendir failed, Permission denied" if I try to read the contents of that directory.
Seeing as it's fully possible to write an application to back up the database to the sdcard (or even to a website), wouldn't that make more sense?
Afterall, there's no need to have the actual database -- and the method is highly restrictive to both people with root on their phones and those with a USB cable and computer handy.
Also, backing up this database will not backup any MMS attachments, which are stored here:
/data/data/com.android.providers.telephony/app_parts/
Refer to the "part" table for an index matching the files there to messages/filenames. (For each MMS, there should be an XML file that helps identify the type of message, and then the file itself, such as a jpeg).
is this the best and safest way to back up sms database as of yet? I have about 1000 sms and it slows down my messaging so I've been try to find a way to free that up. Backing them up would be great so i can clear them.
If anyone has tried this, please share with the rest of us on its effect on the phone.
Thank you,
Hbguy
P.S: This site is truely GREAT because pros are patient with noobs
i don't understand this...i downloaded the file managers on marketplace, and cannot when i click on data file, there is nothing in there..so i dowonloaded a terminal program and still don't understand how to use the commands to move sms from memory to sim...can u do a quick step-by-step? do i have to use any specific programs to do this? sorry, so used to the simplicity of WM6 on my old phone, having trouble adapting to this platform..thanks for any help.
jazzmanmonty said:
i don't understand this...i downloaded the file managers on marketplace, and cannot when i click on data file, there is nothing in there..so i dowonloaded a terminal program and still don't understand how to use the commands to move sms from memory to sim...can u do a quick step-by-step? do i have to use any specific programs to do this? sorry, so used to the simplicity of WM6 on my old phone, having trouble adapting to this platform..thanks for any help.
Click to expand...
Click to collapse
You need to have root on your phone to follow the instructions given above (if you don't know what that means, you don't have it). For non-root users, most of the Android system on the G1 is locked down -- including /data and all its subfolders.
If you do have root on the phone, you can follow the instructions at the top from a terminal while logged in as root. You can verify you are root by running the program "id":
# id
uid=0(root) gid=0(root)
From there, to copy the SMS/MMS database to your sdcard, you can follow the above instructions. If you don't have busybox (ie, "busybox: not found"), you can use the "cat" command as so:
cat /data/data/com.android.providers.telephony/databases/mmssms.db > /sdcard/mmssms.db
You may also want any files stored here:
/data/data/com.android.providers.telephony/app_parts/
Which are from MMSs (if you've no MMSs saved, then you've no need to bother).
Also, not sure if there is a clarification needed for you. The instructions provided offer no way to access SMSs stored on the SIM, as Android uses a PDU interface that doesn't use the SIM's SMS storage space. It is possible to read SMSs off the SIM, however, and into the internal memory storage. See the settings window in the messaging application.
If someone does take the time to create an application to do this, then it would not require root access. Applications are allowed to access the SMS/MMS database, provided the user grants them permission, and could then be used to read the data from the database and into a new database or other file (eg, csv).
do ya think it would be posible to move these permanently to the memory card? ummmm.... ill try if i get a chance ..... ya can connect to phone via adb in recovery mode right ? an undo whatwver i break?
how would you view your backed up sms messages using staulkors sql database?
step by step would be great
hbguy
Just to be clear - for most people on RC30, this probably will not work.
Per http://forum.xda-developers.com/showthread.php?t=442480 the hacks to gain root access have been blocked since RC30 was deployed in early November. Someone should write an application to support this, but instead everybody is busy creating new useless calculators and niche geolocation applications.
If I'm wrong about the above, it would be terrific for anyone to chime in and clarify that.
goodwinm said:
Cool, maybe we'll soon see a port of PIM Backup. Would be nice...
Click to expand...
Click to collapse
https://github.com/jberkel/sms-backup-plus

Where is MMS saved?

I'm sure someone has figured this out.
Where in the file system are the pictures I receive via mms saved?
I'm sure they have to be somewhere, there has to be a way to get them without the fwd to pc email / attach image to new email / email back to phone trick.
Bonus points, I deleted a thread - can I still find those images somewhere in the file system and restore them?
I believe they're stored in a sqlite3 database, so it's not as easy as just copying a file.
It looks like this is the database:
/data/data/com.android.providers.telephony/databases/mmssms.db
I don't have any mms/sms messages atm (recently wiped phone), so I don't have any data to look at in the database.
If you want, give me an IM or PM and I'll give you my cell number so you can send me an sms with a pic, so I can figure out how to extract it from the database
i dont think its in the database: its the same size no matter how many messages there is
Found it. The text and attachments are saved in /data/data/com.android.providers.telephony/app_parts
They are stored in files named something like "PART_1228000671287", with no extension.
To see what type of files they are, you can run this command on the phone (assuming you have RC30 v1.2).
sqlite3 -header /data/data/com.android.providers.telephony/databases/mmssms.db "SELECT _data, ct FROM part;"
The first column is the full path to the file, and the 2nd column is the mime type of the file
Awesome, good work Android Master JesusFreke.
too bad I have the factory RC30
(why oh why did I hit the update button that night?)*
but that's cool to know that they can be found.
Now we just need someone to apply that knowledge into making a SaveImage option appear in the MMS thread.
* on an unrelated note I need to put in another thread: when RC29 came I noticed the camera worked like 5 times better. I was even able to snap pics of the kids on the swings and they came out clear, when RC30 came it was back to blurriness as usual.
JesusFreke said:
Found it. The text and attachments are saved in /data/data/com.android.providers.telephony/app_parts
They are stored in files named something like "PART_1228000671287", with no extension.
To see what type of files they are, you can run this command on the phone (assuming you have RC30 v1.2).
sqlite3 -header /data/data/com.android.providers.telephony/databases/mmssms.db "SELECT _data, ct FROM part;"
The first column is the full path to the file, and the 2nd column is the mime type of the file
Click to expand...
Click to collapse
Would it be possible to write a program that would automatically extract the imgs/vids from that path and put them on the sd card with the correct file extension?
Sure. It would certainly be possible for rooted phones. I'm not sure for non-rooted phones.
I should have added on rooted phones on my first post.
Guess i should get off my butt and start messing around with some code.
I'm kinda leery about messing with root comands.
I think it would be possible for rooted as well. Can't applications have message privys so they can read messages? if they can read them can't they save the data?
JesusFreke said:
Found it. The text and attachments are saved in /data/data/com.android.providers.telephony/app_parts
They are stored in files named something like "PART_1228000671287", with no extension.
To see what type of files they are, you can run this command on the phone (assuming you have RC30 v1.2).
sqlite3 -header /data/data/com.android.providers.telephony/databases/mmssms.db "SELECT _data, ct FROM part;"
The first column is the full path to the file, and the 2nd column is the mime type of the file
Click to expand...
Click to collapse
Now I can save my pictures people texted me! Thanks dude!

How can I export my Shazam tagged songs list?

Before formatting my TD2 I made a full backup.
Now I want to transfer my Shazam tagged songs list back.
Simple copy paste from the backup is not working.
Where Shazam is keeping the list of tagged songs?
How do I export that list?
__________
Update: found it!
Can someone please open this attached shazam.db (from shazam for wm 6.5 ) and return the song list , date and time in some other format? xls, cvs etc.
Thanks!
Update:
Shazam.db file in aplication data\shazam\folder is where all tags are stored.
Did you have any luck with this? I was hoping to do the same thing, but I hit a wall when I realized that I don't know how to access files on my Droid's internal storage. Would you mind pointing me in the right direction?
Found nothing so far.
Anyone?
Incorrect....
Either the htc hero has a different file structure or this information is inaccurate....
There is no such file path.
I whipped a quick app (attached below) that can back up the shazam database file to your SDCard (in folder "shazambackup") and restores it need be.
Also you can export the Tagged songs to xml (saved as "exports.xml" in the "shazambackup" folder).
Next i'll probably parse the xml to a more readable format. Maybe CSV? or just Plain Text? Any ideas are welcome!
Let me know if you have any issues. So far i've only tested it on my G1. Must also have a rooted phone for any of this to work.
Can you please open this shazam.db (from wp6.5) and return the song list , date and time in some other format? xls, cvs etc.
Thanks!
bump.
Anyone can help?
See first post.
You're dealing with mostly Android here, you may want to ask in a WM or phone specific forum.
(from... Evo/MIUI/Tapatalk)
kokenjr said:
I whipped a quick app (attached below) that can back up the shazam database file to your SDCard (in folder "shazambackup") and restores it need be.
Also you can export the Tagged songs to xml (saved as "exports.xml" in the "shazambackup" folder).
Next i'll probably parse the xml to a more readable format. Maybe CSV? or just Plain Text? Any ideas are welcome!
Let me know if you have any issues. So far i've only tested it on my G1. Must also have a rooted phone for any of this to work.
Click to expand...
Click to collapse
Does not work properly on Desire. Opens the app after installation but "backup" button does not create the backup file and "Export to XML" makes the app force close without exporting anything.
About the export feature - the CSV version would probably be the best.
Thanks!
p666nn said:
About the export feature - the CSV version would probably be the best.
Thanks!
Click to expand...
Click to collapse
Can you or someone please export attached shazam.db (zip) in any other usable format?
Thanks!
Bumb!
BUMP!!!!!!
CSV would be great
The app's export to xml feature also fails on HTC Evo 4G (GingerBread).
Solution with SQLite
Hi everybody,
I found a solution to export the list via SQLite. I had to find it for myself as I found nothing on the web, but I put it here, so perhaps somebody else is looking for such a solution as well.
This explanation is about how to get Shazam's data base file from your Android phone, access it on your computer and export a list of your tagged songs.
1. COPY FILE FROM PHONE
The data is stored in the file on your Android:
/data/data/com.shazam.android/databases/library.db
You have to copy this file to your Computer to work with it. Probably everybody does this in a different way. Mine was probably a bit more difficult than necessary, there should be simpler ways (e.g. with ssh / scp), but mine was: Opening the Android app "Terminal" and typing in the command:
Code:
cp /data/data/com.shazam.android/databases/library.db /sdcard
Then the file was copyed on the sdcard, which I could access to with my computer via USB cable.
Then you need a program which can open SQLite-Files. There is the command line tool (at least in Linux) "sqlite3", but also graphical tools for Linux/Windows/Mac like the "sqlitebrowser" (Link: sourceforge.net/projects/sqlitebrowser).
2. OUTPUT FROM DATA BASE:
In every of these tools, you can execute SQL-commands. For my output I chose:
Code:
SELECT a.name , t.title, t.subtitle, t.album, t.subgenre_name, tg.short_datetime, tg.location_name , tg.lat, tg.lon
FROM artist a, artist_track at, track t, tag tg
WHERE a.id = at.artist_id AND at.track_id = t._id AND tg.track_id = t._id ORDER BY tg.timestamp;
This command displays a list of the songs, ordered by their timestamp.
So with the command line tool "sqlite3" you just type in:
sqlite3 -line /tmp/library.db "SELECT a.name , t.title, t.subtitle, t.album, t.subgenre_name, tg.short_datetime, tg.location_name , tg.lat, tg.lon FROM artist a, artist_track at, track t, tag tg WHERE a.id = at.artist_id AND at.track_id = t._id AND tg.track_id = t._id ORDER BY tg.timestamp;"
Click to expand...
Click to collapse
The output is in lines, you could also let put this in a text file by e.g. adding to this command:
"[see above] > shazam-tracks.txt"
Click to expand...
Click to collapse
There is also a way to export the data into an html table (just the table, no complete html file), by changing "-line" for "-html". For further details on how to export everything to a different file format (CVS etc) have a look on the Manpage of sqlite3 (command "man sqlite3").
With the graphical tool "sqlitebrowser" it is imho only possible to show this list, not to export it to a textfile. After having opened the .db-file with the program, you chose the tab "Execute SQL" and put there the above SQL command ("SELECT [...]"). Voilà!
3. DETAILS:
What I do like this is combining the necessary data of the database. They are spread over several tables. There is a table "artist" with the list of the artists and their unique ids. Then there is the same for the tracks, "track". In the "artist_track" table there is listed, which artist's id belongs tho which track's id. Finally in the table "tag" there are additional data like the time stamp of the song and even it's geo data tag.
With the SQLite program you can easily watch all the data and add / remove data from the SQL command, as you wish.
So far, I hope, I could help somebody?
Greetings, spectas
spectas said:
Hi everybody,
I found a solution to export the list via SQLite. I had to find it for myself as I found nothing on the web, but I put it here, so perhaps somebody else is looking for such a solution as well.
This explanation is about how to get Shazam's data base file from your Android phone, access it on your computer and export a list of your tagged songs.
1. COPY FILE FROM PHONE
The data is stored in the file on your Android:
/data/data/com.shazam.android/databases/library.db
You have to copy this file to your Computer to work with it. Probably everybody does this in a different way. Mine was probably a bit more difficult than necessary, there should be simpler ways (e.g. with ssh / scp), but mine was: Opening the Android app "Terminal" and typing in the command:
Code:
cp /data/data/com.shazam.android/databases/library.db /sdcard
Then the file was copyed on the sdcard, which I could access to with my computer via USB cable.
Then you need a program which can open SQLite-Files. There is the command line tool (at least in Linux) "sqlite3", but also graphical tools for Linux/Windows/Mac like the "sqlitebrowser" (Link: sourceforge.net/projects/sqlitebrowser).
2. OUTPUT FROM DATA BASE:
In every of these tools, you can execute SQL-commands. For my output I chose:
Code:
SELECT a.name , t.title, t.subtitle, t.album, t.subgenre_name, tg.short_datetime, tg.location_name , tg.lat, tg.lon
FROM artist a, artist_track at, track t, tag tg
WHERE a.id = at.artist_id AND at.track_id = t._id AND tg.track_id = t._id ORDER BY tg.timestamp;
This command displays a list of the songs, ordered by their timestamp.
So with the command line tool "sqlite3" you just type in:
The output is in lines, you could also let put this in a text file by e.g. adding to this command:
There is also a way to export the data into an html table (just the table, no complete html file), by changing "-line" for "-html". For further details on how to export everything to a different file format (CVS etc) have a look on the Manpage of sqlite3 (command "man sqlite3").
With the graphical tool "sqlitebrowser" it is imho only possible to show this list, not to export it to a textfile. After having opened the .db-file with the program, you chose the tab "Execute SQL" and put there the above SQL command ("SELECT [...]"). Voilà!
3. DETAILS:
What I do like this is combining the necessary data of the database. They are spread over several tables. There is a table "artist" with the list of the artists and their unique ids. Then there is the same for the tracks, "track". In the "artist_track" table there is listed, which artist's id belongs tho which track's id. Finally in the table "tag" there are additional data like the time stamp of the song and even it's geo data tag.
With the SQLite program you can easily watch all the data and add / remove data from the SQL command, as you wish.
So far, I hope, I could help somebody?
Greetings, spectas
Click to expand...
Click to collapse
Thanks!!! It helped me since Shazam no longer gets past the setup screen!
I found that with SQliteExport you can use your same command above and export to a file of your choice, for example, xls or csv. Here's the link to the little program:
http://www.speqmath.com/tutorials/sqlite_export/index.html
Flyview said:
Thanks!!! It helped me since Shazam no longer gets past the setup screen!
I found that with SQliteExport you can use your same command above and export to a file of your choice, for example, xls or csv. Here's the link to the little program:
http://www.speqmath.com/tutorials/sqlite_export/index.html
Click to expand...
Click to collapse
Tried but cant do it. I need step by step instruction. Or better, can someone just export the db that I attached? (See OP - first post - shazam.db ?)
Thanks
K
Best solution for exporting from shazam database
Delete this one please
Hello I am new on the forum. I've learned a lot of things in this website, it's time to payback
I’ve got another solution to this issue….
1.-Download this plugin for Firefox.
addons.mozilla.org/es/firefox/addon/sqlite-manager
2.- In Firefox – Tools, select SQLite Manager
3.- In the new window select database – connect database – then open your db from shazam
4.- Then you’ll see two panels. on left panel select track and on right panel, select browse and search then you’ll be able to see all your tag info
5.- On the left panel select track – right click – export table, select csv on right panel then ok.
6.- Open your new saved database with any office (word, excel)
7.- That’s all
Shazam Tags
snakesight said:
Hello I am new on the forum. I've learned a lot of things in this website, it's time to payback
I’ve got another solution to this issue….
1.-Download this plugin for Firefox.
addons.mozilla.org/es/firefox/addon/sqlite-manager
2.- In Firefox – Tools, select SQLite Manager
3.- In the new window select database – connect database – then open your db from shazam
4.- Then you’ll see two panels. on left panel select track and on right panel, select browse and search then you’ll be able to see all your tag info
5.- On the left panel select track – right click – export table, select csv on right panel then ok.
6.- Open your new saved database with any office (word, excel)
7.- That’s all
Click to expand...
Click to collapse
This above works well nice one.
I was trying to do my own program before I saw this.I'm not a programmer but I stuck together a few bits of code I found and hopefully works you you. Use android app Root Browser Lite to copy file from data/data/com.shazam.android/databases/library.db to your sd card. Or use the app posted earlier which does this for you.
Put library.db file from you Shazam backup in the same folder as this program and run program and hit 'GetTags' and should get CSV and htm versions of your tags. No error checking or anything fancy in this program. Requires .NET 3.5. May only work on 32-bit machines. I'd like to enhance this and will if people find it useful.
How results should look.

[Q] File created on handset shows up as 0 bytes on MTP USB interface

I am running CyanogenMod (CM) 12 on my 1st generation Moto G. In the root directory as shown via the file manager, I created a "notes" folder, where I store text files. Files that I copy over from Windows 7 seem fine.
As an *aside*, the only proviso is that the native CM text editor uses Unix line endings (LF only, not CR+LF). So if the text files were DOS to begin with, any new lines of text added on the handset will have only LF, while old lines will have CR+LF. The CM text editor handles this well, seemingly treating both line endings in the same way.
I have a problem with any *new* text files created on the handset. I am not sure whether the problem is somehow related to the line endings. On the handset, I created a file tmp.txt of length 160 bytes (it contains 160 characters). When I view the text file from Windows 7 using the MTP interface, windows explorer shows the file as having 0 bytes. When I drag the file over to a Windows folder on the laptop, it is basically an empty file. Very bad.
I can use adb to pull the file over, and then it's fine (it's not empty). As a side note, the source path as seen in the handset file manager must be prefixed with storage/emulated/legacy/ when using adb pull.
I do not want to use adb pull to copy over a whole bunch of files. The klag in that process would make it a real headache. I will be regularly mirroring these text files between the laptop and the handset.
Can anyone suggest a reason why a file created on the handset looks so bizzarely empty when viewed over the MTP USB interface? Can anyone suggest a hopefully elegant workaround that doesn't involve too much geeking out? Geeking out is all fun and that, but the handset was really meant to save me time rather than become a project in itself.
Thanks.
It looks like I can avoid individually pulling and pushing files because adb push/pull are recursive commands. The source argument can be a list of multiple files. I might have found from google that a destination directory on the handset must be specified in terms of ./relative/path or might have needed a terminating "/" -- I can't remember, and unfortunately, I closed down my bash shell, so I can't examine the history.

Extracting contacts2.db to vCard

Spent a fair bit of time searching, and had some trouble trying to get this to work, so I figured I'd share what ended up working for me in case someone else ends up in a similar position and tries googling around for it. I used the perl script at https://github.com/tmo1/contacts2vcard - everything else struggled to handle either the exported .csv table or I had trouble with errors.
I wanted to extract my contacts, but since I had a more or less bricked phone I couldn't export as vCard nor upload them to some cloud service.
Steps:
1. Grab the contacts2.db file (if you have a large -wal then consider performing a 'vacuum" See: https://stackoverflow.com/questions...f-sqlite-3-7-wal-file-into-main-database-file)
2. Get Perl running if you haven't, and install dependencies listed
3. Run the script, get vCard, drop onto new phone, open it and import.
A few notes
- If you're on windows, install something like strawberry perl, then go to the cmd line and install https://metacpan.org/pod/vCard and https://metacpan.org/pod/DBD::SQLite as dependencies. Install instructions you can paste into the command line are on the left side under the Tools category - click it and it'll give you the command prompt ready input you can copy/paste.
- Even on Android 12, import didn't work when I had exported as vCard 4.0 - I used the -v 2.1 switch and then everything imported flawlessly.

Categories

Resources