Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. protected String doInBackground(String... filename) {
  2. String sdcard = Environment.getExternalStorageDirectory().toString();
  3. File file = new File(sdcard+"/androrec/");
  4. //File file2 = new File("/mnt/sdcard/CallRecorderBackup");
  5.  
  6. File[] listofFiles = file.listFiles();
  7. Log.d("No. of files" ,fileArrayToString(listofFiles));
  8. try{
  9. //........................ this is connection........................
  10. client.connect(FTP_HOST,21);
  11. client.login(FTP_USER, FTP_PASS);
  12.  
  13.  
  14. for (int i = 0; i <=listofFiles.length ; i++) {
  15.  
  16.  
  17. Log.d("Tag 4", "inside of ftp connect");
  18.  
  19. Log.d("Tag 1", "inside of for loop");
  20. //if(purchases != null && !purchases.isEmpty()){
  21. if (listofFiles == null || listofFiles[i].isFile()) {
  22. Log.d("Tag 2", "inside of if");
  23. String files = listofFiles[i].getName();
  24. Log.d("Tag 3", "inside of files");
  25. File filetoload = new File(sdcard+"/androrec/"+files);
  26.  
  27.  
  28. //client.connect(FTP_HOST,21);
  29. Log.d("Tag 4", "inside of ftp connect");
  30.  
  31. Log.d("Tag 5", "inside of for ftp pass");
  32. //client.setType(FTPClient.TYPE_BINARY);
  33. //client.changeDirectory("/");
  34. Log.d("Tag 6", "inside of for dir");
  35.  
  36. client.upload(filetoload, new MyTransferListener());
  37. Log.d("Tag 7", "inside of download");
  38. //out.write(buf, 0, len);
  39. //}
  40. //}
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. // client.upload(in, new MyTransferListener());
  48.  
  49. }
  50. else{
  51.  
  52. }
  53. //client.disconnect(true);
  54. }
  55. }
  56.  
  57. catch (IllegalStateException | IOException
  58. | FTPIllegalReplyException | FTPException e) {
  59. // TODO Auto-generated catch block
  60. e.printStackTrace();
  61. } catch (FTPDataTransferException e) {
  62. // TODO Auto-generated catch block
  63. e.printStackTrace();
  64. } catch (FTPAbortedException e) {
  65. // TODO Auto-generated catch block
  66. e.printStackTrace();
  67. }
  68.  
  69.  
  70. try {
  71. client.disconnect(true);
  72. } catch (Exception e2) {
  73. e2.printStackTrace();
  74. }
  75. return null;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement