Android Question Copy from root of USB Pendrive to (internal) /storage/emulated/0

Diego Marcelo Croatto

Member
Licensed User
Hi I try to copy the file cmdb.db in a root of USB pendrive and copy this file to the internal storage path /storage/emulated/0

Copy USB to Internal:
    Sub btnCopy_Click
    
    Dim filetocopy As String = "cmdb.db" 'file to copi from USB root
    Dim inpstr As InputStream=Storage.FindFile(Storage.Root,filetocopy)
    Dim os As OutputStream= File.OpenOutput(File.DirRootExternal,filetocopy,True)
    
    File.Copy2(inpstr,os)
    
    End If

The file is created but not copyed fully into the destination path.... can anyone help me?... thanks a lot.
 

DonManfred

Expert
Licensed User
Longtime User
1. You ARE using runtimepermission for the File.DirRootExternal path?

2. Storage is the ExternalStorage Class?
Dim inpstr As InputStream=Storage.FindFile(Storage.Root,filetocopy)
3. findFile returns a INPUTSTREAM??
 
Upvote 0

Diego Marcelo Croatto

Member
Licensed User
I solve it ....

USB_to_Zip is the code project and cmdb.zip is the db file to copy in the root of the USB Pendrive device.

Screenshot_20200411-200049.png
Main screen with Copy button (the status of copy shows in the log)

Screenshot_20200411-200235.png
USB device selector (only first time)

Screenshot_20200411-200243.png
Access confirmation (only first time)

Thank's Don šŸ˜‰
 

Attachments

  • USB_to_Internal.zip
    129.3 KB · Views: 179
  • cmdb.zip
    379.9 KB · Views: 167
  • Screenshot_20200411-200054.png
    Screenshot_20200411-200054.png
    21.7 KB · Views: 154
Upvote 0
Top