Examples of FTPFile


Examples of com.enterprisedt.net.ftp.FTPFile

       
        // put to a random filename
        String filename = generateRandomFilename();
        ftp.put(localDataDir + localTextFile, filename);

        FTPFile ftpFile = ((FTPClient)ftp).fileDetails(filename);
       
        log.debug("[" + ftpFile.toString() +"]");
       
        ftp.delete(filename);
       
        ftp.quit();
    }
View Full Code Here

Examples of com.enterprisedt.net.ftp.FTPFile

        tools.setUser("anonymous");
        tools.setPassword("test@test.com");

        connect();
               
        FTPFile ftpFile = ((FTPClient)ftp).fileDetails("index_renamed.html");
       
        log.debug("[" + ftpFile.toString() +"]");
               
        ftp.quit();
    }
View Full Code Here

Examples of com.oroinc.net.ftp.FTPFile

         throws IOException, BuildException {
        if (verbose) {
            log("listing " + filename);
        }

        FTPFile ftpfile = ftp.listFiles(resolveFile(filename))[0];

        bw.write(ftpfile.toString());
        bw.newLine();

        transferred++;
    }
View Full Code Here

Examples of de.kout.wlFxp.ftp.FtpFile

    int n = list.size();
    for (int i = n / 2; i > 0; i--) {
      reheap(list, i, n, sortBy, prio, prioList);
    }
    for (int m = n; m > 0; m--) {
      FtpFile t = (FtpFile) list.elementAt(0);
      list.setElementAt(list.elementAt(m - 1), 0);
      list.setElementAt(t, m-1);
      reheap(list, 1, m - 1, sortBy, prio, prioList);
    }
  }
View Full Code Here

Examples of de.kout.wlFxp.ftp.FtpFile

   *@param  sortBy  Description of the Parameter
   *@return         result of compareToIgnoreCase
   */
  private static int compareFiles(Object o1, Object o2, String sortBy,boolean prio, Vector prioList) {
    int ret;
    FtpFile f1 = (FtpFile) o1;
    FtpFile f2 = (FtpFile) o2;
    if (prio) {
      int m1 = matches(prioList, f1.getName()), m2 = matches(prioList, f2.getName());
      if (m1 != -1 || m2 != -1) {
        if (m1 > m2) {
          return -1;
        }
        else if (m2 > m1) {
          return 1;
        }
      }
    }
    if (f1.isDirectory() && !f2.isDirectory()) {
      return -1;
    }
    if (!f1.isDirectory() && f2.isDirectory()) {
      return 1;
    }
    if (sortBy.equals("Name")) {
      return f1.getName().compareToIgnoreCase(f2.getName());
    } else if (sortBy.equals("IName")) {
      return -f1.getName().compareToIgnoreCase(f2.getName());
    } else if (sortBy.equals("Size")) {
      ret = (int) (f1.getSize() - f2.getSize());
    } else if (sortBy.equals("ISize")) {
      ret = (int) (f2.getSize() - f1.getSize());
    } else if (sortBy.equals("Date")) {
      if (f1.getDate().indexOf("/") == 2 && f2.getDate().indexOf("/") > 2) {
        return 1;
      } else if (f1.getDate().indexOf("/") > 2 && f2.getDate().indexOf("/") == 2) {
        return -1;
      }
      ret = f1.getDate().compareToIgnoreCase(f2.getDate());
    } else if (sortBy.equals("IDate")) {
      if (f1.getDate().indexOf("/") == 2 && f2.getDate().indexOf("/") > 2) {
        return -1;
      } else if (f1.getDate().indexOf("/") > 2 && f2.getDate().indexOf("/") == 2) {
        return 1;
      }
      ret = -f1.getDate().compareToIgnoreCase(f2.getDate());
    } else {
      return f1.getName().compareToIgnoreCase(f2.getName());
    }
    if (ret == 0) {
      ret = f1.getName().compareToIgnoreCase(f2.getName());
    }
    return ret;
  }
View Full Code Here

Examples of de.kout.wlFxp.ftp.FtpFile

   */
  public static Vector parseList(String output, String ftpDir) {
    String[] completeList = split(output, "\r\n");
  //  FtpFile[] tmpfiles = new FtpFile[completeList.length];
    Vector files = new Vector(completeList.length, 100);
    FtpFile tmp;
    int k = 0;
    int index;
    for (int i = 0; i < completeList.length; i++) {
//      if (!Pattern.matches("([A-Za-z][A-Za-z][A-Za-z]) .[0-9] [0-9 ][0-9]", completeList[i]))
      // ...
      index = -1;
      int j = 0;
      int tindex = 0;
      while (j < monthsWS.length) {
        tindex = completeList[i].indexOf(monthsWS[j]);
        if (tindex != -1 && (index == -1 || tindex < index)) {
          index = tindex;
        }
        j++;
      }
      if (index == -1) {
        continue;
      }
//      System.out.println(index);
      tmp = new FtpFile("");
      files.addElement(tmp);
      if (completeList[i].indexOf(" -> ") != -1) {
        completeList[i] = completeList[i].substring(0, completeList[i].indexOf(" -> "));
      }
      tmp.setName(completeList[i].substring(
          completeList[i].substring(index + 10,
          completeList[i].length()).indexOf(" ")
           + 11 + index,
          completeList[i].length()));
      // if the server outputs the "." or ".." with list
      if (tmp.getName().equals(".")
           || tmp.getName().equals("..")) {
        files.removeElementAt(files.size()-1);
        continue;
      }
      tmp.setSize(Long.parseLong(completeList[i].substring(completeList[i].substring(0, index).lastIndexOf(" ") + 1, index)));
      tmp.setMode(completeList[i].substring(0, 10));
      tmp.setFtpMode(true);
      tmp.setDate(parseDate(completeList[i].substring(index, index + 13)));
      if (ftpDir.equals("/"))
        tmp.setAbsolutePath(ftpDir + tmp.getName());
      else
        tmp.setAbsolutePath(ftpDir +"/"+tmp.getName());
      k++;
    }
    return files;
  }
View Full Code Here

Examples of de.kout.wlFxp.ftp.FtpFile

        wlPanel panel = (wlPanel) cmd.firstElement();
        cmd.removeElementAt(0);
        try {
          Transfer transfer = (Transfer) cmd.firstElement();
          cmd.removeElementAt(0);
          FtpFile file = transfer.getSource();
          FtpFile to = transfer.getDest();
          // if dir add files in dir to queue
          if (file.isDirectory()) {
            new File(to.getAbsolutePath()).mkdir();
            frame.getQueueList().removeFirst();
            frame.getQueueList().updateView();
            FtpFile[] files = file.list();
            for (int i = files.length - 1; i >= 0; i--) {
              FtpFile tmp = new FtpFile(files[i].getName());
              tmp.setFtpMode(false);
              tmp.setAbsolutePath(to.getAbsolutePath() + File.separator + files[i].getName());
              frame.getQueueList().addAtBegin(new Transfer(files[i], tmp, transfer.modeFrom, transfer.modeTo, transfer.from_to, null, null));
            }
          // copy the file
          } else {
            copyFileToDir(file, to, panel);
View Full Code Here

Examples of de.kout.wlFxp.ftp.FtpFile

      panel.open();
    } else if (cmd.equals("Rename")) {
      int row = panel.view.getSelectedIndex();
      if (row == 0)
        return;
      FtpFile entry = (FtpFile) panel.view.getElementAt(row);
      panel.renameFile =  entry;
      new InputDialog(panel, "Rename", entry.getName(), false);
    } else if (cmd.equals("refresh")) {
      panel.updateView();
    } else if (cmd.equals("transfer")) {
      panel.addTransfers();
      panel.frame.transfer();
View Full Code Here

Examples of de.kout.wlFxp.ftp.FtpFile

        if (row == 0) {
          if (new File(panel.dir).getParent() != null) {
            panel.setDir(new File(panel.dir).getParent());
          }
        } else {
          FtpFile entry = (FtpFile) panel.view.getElementAt(row);
          if (entry.isDirectory()) {
            // add the entry
            if (panel.dir.endsWith(File.separator)) {
              panel.setDir(panel.dir + entry.getName());
            } else {
              panel.setDir(panel.dir + File.separator + entry.getName());
            }
          }
        }
      } else if (panel.mode == panel.FTP) {
        // if is Directory
        // make parent
        if (row == 0) {
          panel.ftpSession.cdup();
        } else {
          FtpFile entry = (FtpFile) panel.view.getElementAt(row);
          if (entry.isDirectory() || entry.isLink()) {
            // add entry
            if (panel.ftpDir.endsWith("/")) {
              panel.setDir(panel.ftpDir + entry.getName());
            } else {
              panel.setDir(panel.ftpDir + "/" + entry.getName());
            }
          }
        }
      }
    }
View Full Code Here

Examples of de.kout.wlFxp.ftp.FtpFile

        if (panel.view.rowAtPoint(p) == 0) {
          if (new File(panel.dir).getParent() != null) {
            panel.setDir(new File(panel.dir).getParent());
          }
        } else {
          FtpFile entry = (FtpFile) panel.view.getElementAt(p);
          if (entry.isDirectory()) {
            // add the entry
            if (panel.dir.endsWith(File.separator)) {
              panel.setDir(panel.dir + entry.getName());
            } else {
              panel.setDir(panel.dir + File.separator + entry.getName());
            }
          }
        }
      } else if (panel.mode == panel.FTP) {
        // if is Directory
        // make parent
        if (panel.view.rowAtPoint(p) == 0) {
          panel.ftpSession.cdup();
        } else {
          FtpFile entry = (FtpFile) panel.view.getElementAt(p);
          if (entry.isDirectory() || entry.isLink()) {
            // add entry
            if (panel.ftpDir.endsWith("/")) {
              panel.setDir(panel.ftpDir + entry.getName());
            } else {
              panel.setDir(panel.ftpDir + "/" + entry.getName());
            }
          }
        }
      }
    } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.