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.

Main screen with Copy button (the status of copy shows in the log)

USB device selector (only first time)

Access confirmation (only first time)

Thank's Don
 

Attachments

  • USB_to_Internal.zip
    129.3 KB · Views: 185
  • cmdb.zip
    379.9 KB · Views: 173
  • Screenshot_20200411-200054.png
    21.7 KB · Views: 161
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…