title: android how can i read file or directory from usb host and copy to other place
body: <p>I need your help, I'm trying to read some directory and trying to copy it to another place.
  Now I can connect to usb host and read the usb specifications but i can´t read the information on the usb to copy it.</p>
  
  <p>this is my code</p>
  
  <pre><code> if (ACTION_USB_PERMISSION.equals(action)) {
              synchronized (this) {
                  UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
  
                  if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
                      if (device != null) {
                          //call method to set up device communication
                          byte[] bytes = new byte[0];
                          int TIMEOUT = 0;
                          boolean forceClaim = true;
                           intf = device.getInterface(0);
                          UsbEndpoint endpoint = intf.getEndpoint(0);
                           connection = manager.openDevice(device);
                          connection.claimInterface(intf, forceClaim);
                          bytes=connection.getRawDescriptors();
                          Toast.makeText(context,"PERMISO CONCEDIDO",Toast.LENGTH_SHORT).show();
                          ArrayList&lt;String&gt;directorios=new ArrayList&lt;&gt;();
                          directorios=ObtnerDirectorios("/storage/UsbDriveA");
                          String dir="";
                          for(int i=0; i&lt;directorios.size();i++){
                              dir+=directorios.get(i)+"\n";
                          }
                          infotext.setText(dir);
  
  
                      }
                  } else {
                      Toast.makeText(context,"PERMISO DENEGADO",Toast.LENGTH_SHORT).show();
                  }
              }
          }
  </code></pre>
  
  <p>I read the google documentation and I think t have to use a bulktransfer and control transfer but I'm not sure.
  Could you help me?</p>
  
  <p>Thanks</p>