Copy Local Sqlite .db file to another path location

Hey,

So I am trying to copy out the local .db file so users can import it on another device and use it with the app.

The DB file is stored here: **string dbPath= Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "moose.db");
**
I tried File.Move, File.Copy but no go with that. Any suggestions?

Best Answer

  • Moose6Moose6 ✭✭
    edited July 8 Accepted Answer

    Actually I discovered the actual File Path and it works with File.Copy or File.Move.

    Use : /storage/emulated/0/Download/databasename.db

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    I think you should explain better which is the result. Do you have an excetpion?

    If you have to copy the file to an External Storage you should give permission…. are them ok?

  • Moose6Moose6 Member ✭✭

    You are correct my apologies.

                 string src = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "moose.db");
                                string dest = ("//sdcard//Download//moose.db//");
                                File.Copy(src, dest);
    

    Says that Destination Path does not exist. All permissions are set in the manifest file.

  • Moose6Moose6 Member ✭✭
    edited July 8 Accepted Answer

    Actually I discovered the actual File Path and it works with File.Copy or File.Move.

    Use : /storage/emulated/0/Download/databasename.db

Sign In or Register to comment.