Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected String doInBackground(String... filename) {
- String sdcard = Environment.getExternalStorageDirectory().toString();
- File file = new File(sdcard+"/androrec/");
- //File file2 = new File("/mnt/sdcard/CallRecorderBackup");
- File[] listofFiles = file.listFiles();
- Log.d("No. of files" ,fileArrayToString(listofFiles));
- try{
- //........................ this is connection........................
- client.connect(FTP_HOST,21);
- client.login(FTP_USER, FTP_PASS);
- for (int i = 0; i <=listofFiles.length ; i++) {
- Log.d("Tag 4", "inside of ftp connect");
- Log.d("Tag 1", "inside of for loop");
- //if(purchases != null && !purchases.isEmpty()){
- if (listofFiles == null || listofFiles[i].isFile()) {
- Log.d("Tag 2", "inside of if");
- String files = listofFiles[i].getName();
- Log.d("Tag 3", "inside of files");
- File filetoload = new File(sdcard+"/androrec/"+files);
- //client.connect(FTP_HOST,21);
- Log.d("Tag 4", "inside of ftp connect");
- Log.d("Tag 5", "inside of for ftp pass");
- //client.setType(FTPClient.TYPE_BINARY);
- //client.changeDirectory("/");
- Log.d("Tag 6", "inside of for dir");
- client.upload(filetoload, new MyTransferListener());
- Log.d("Tag 7", "inside of download");
- //out.write(buf, 0, len);
- //}
- //}
- // client.upload(in, new MyTransferListener());
- }
- else{
- }
- //client.disconnect(true);
- }
- }
- catch (IllegalStateException | IOException
- | FTPIllegalReplyException | FTPException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (FTPDataTransferException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (FTPAbortedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- client.disconnect(true);
- } catch (Exception e2) {
- e2.printStackTrace();
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement