7

I have extracted my contacts2.db from a nandroid backup. I'd like to convert that to one or many .vcf files so that I can use my contacts in other applications.

I already found an answer that dealt with .db files but it did not work for this. I don't know if I did something wrong.

7
  • Do you want to export your contacts numbers or convert a .db file to .vcf? Because that is not the only way
    – Lucio
    Apr 10, 2014 at 14:27
  • What kind of file is your .db file, actually? Post the output of file contacts2.db run from a terminal in the directory where the file resides.
    – tgies
    Apr 10, 2014 at 14:30
  • @tgies contacts2.db is a sqlite3 database.
    – Oli
    Apr 10, 2014 at 14:41
  • @Lucio Now I have the nandroid backup, so I extracted the contacts2.db, and I want to convert it to a .vcf file, so i could have my contacts in my new phone (I didn't use the google sync, I forgot)
    – user267502
    Apr 10, 2014 at 15:01
  • "ir did not work for this", how?
    – Braiam
    Apr 10, 2014 at 15:48

1 Answer 1

10

This seems to have been answered on our Android sister-site by Chauncellor:

Well, this took a long time. For future searchers, here's what you can do:

Find your contacts2.db file hidden somewhere in Android. Most of the time it's located in /data/data/com.android.providers.contacts/databases. I was lucky and found it in a search through Titanium Backups' tarballs. Nab that file. It has everything in it in a sql database.

I then found this excellent script to extract and convert all contacts into a .vcf format for easy importing into the next device. It's located here on Github and requires two dependencies (on an Ubuntu 12.04 machine in which it was written for): sqllite3 and libsqllite3-dev:

sudo apt-get install sqlite3 libsqlite3-dev

After dependencies are satisfied, save the script on Github as dbconverter.sh. Mark it as executable:

chmod +x dbconverter.sh

use the script like this:

./dbconverter.sh contacts2.db > contacts2.vcf

You will then have a lovely .vcf file for easy importing into your phone.

There are also other programmatic approaches on SO:

4
  • ubuntu@ubuntu:~$ ./dbconverter.sh contacts2.db > contacts2.vcf bash: ./dbconverter.sh: No such file or directory ... I don't know what to do here!
    – user267502
    Apr 10, 2014 at 14:57
  • You have to download and make executable the script from github.
    – Oli
    Apr 10, 2014 at 15:24
  • I downloaded the script, from the button on the right "Download Zip" and i did make the file "dbconverter.sh" executable, Properties,Permission tab, Check “Allow executing file as program.”
    – user267502
    Apr 10, 2014 at 15:52
  • 1
    Ancient answer and OP is probably not here to mark it as accepted, but if anyone else is looking for this just wanted to report that it worked perfectly fine for me after 5 years, though I'm cheating because I'm a debian user. I just cloned the repo, marked it as executable, and successfully converted my file.
    – pipe
    Jun 26, 2019 at 18:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .