Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClient.changeWorkingDirectory()


        return false;
      if (!FTPReply.isPositiveCompletion(client.getReplyCode()))
        return false;
     
      client.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
      client.changeWorkingDirectory("Flibus");

      out = new FileOutputStream("entryToken.txt");
      out.write((new String(new Boolean(val).toString())).getBytes());
      out.close();
View Full Code Here


      }

      if (debugMode)
        System.out.println("Le dossier courant est: " + client.printWorkingDirectory());

      if (!client.changeWorkingDirectory("Flibus"))
        return false;
      if (debugMode)
        System.out.print(client.getReplyString());

      // client.enterLocalPassiveMode();
View Full Code Here

      client.login(ftpLogin, ftpPass);
      if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
        return false;
      }
      client.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
      client.changeWorkingDirectory("Flibus");
      if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
        return false;
      }

      String filename = xmlFilePath;
View Full Code Here

      if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
        return false;
      }

      client.setFileTransferMode(FTPClient.STREAM_TRANSFER_MODE);
      client.changeWorkingDirectory("Flibus");

      fos = new FileOutputStream("entryToken.txt");
      if (!client.retrieveFile("entryToken.txt", fos))
        return false;
      if (!FTPReply.isPositiveCompletion(client.getReplyCode())) {
View Full Code Here

        }
        String path = url.getPath();
        String workingDir = path.substring(0, path.lastIndexOf("/"));
        String file = path.substring(path.lastIndexOf("/")+1);
       
        ftp.changeWorkingDirectory(workingDir);
        ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
        InputStream input = ftp.retrieveFileStream(file);
        ftp.quit();
        ftp.disconnect();
       
View Full Code Here

            if (action == MK_DIR) {
                makeRemoteDir(ftp, remotedir);
            } else {
                if (remotedir != null) {
                    log("changing the remote directory", Project.MSG_VERBOSE);
                    ftp.changeWorkingDirectory(remotedir);
                    if (!FTPReply.isPositiveCompletion(ftp.getReplyCode())) {
                        throw new BuildException("could not change remote "
                             + "directory: " + ftp.getReplyString());
                    }
                }
View Full Code Here

    private void ftpUpload(String srcFileName, String distLocation) throws IOException {
        FTPClient client = new FTPClient();
        FileInputStream fis = null;
        client.connect(srvHost);
        client.login(userName, password);
        client.changeWorkingDirectory(distLocation);
        String filename = srcFileName;
        fis = new FileInputStream(filename);
        client.storeFile(filename, fis);
        client.logout();
        fis.close();
View Full Code Here

            String workingDir = path.substring(0, path.lastIndexOf("/"));
        String filename = message.getMessageId().toString().replaceAll(":", "_");
            ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
           
            String url;
            if(!ftp.changeWorkingDirectory(workingDir)) {
              url = this.url.toString().replaceFirst(this.url.getPath(), "")+"/";
            } else {
              url = this.url.toString();
            }
           
View Full Code Here

    // file
    // on the server by opening up an InputStream. As a side effect the working
    // directory on the server is changed to the parent directory of the file.
    // The FTP client connection is closed when close() is called on the
    // FSDataInputStream.
    client.changeWorkingDirectory(parent.toUri().getPath());
    InputStream is = client.retrieveFileStream(file.getName());
    FSDataInputStream fis = new FSDataInputStream(new FTPInputStream(is,
        client, statistics));
    if (!FTPReply.isPositivePreliminary(client.getReplyCode())) {
      // The ftpClient is an inconsistent state. Must close the stream
View Full Code Here

    // Change to parent directory on the server. Only then can we write to the
    // file on the server by opening up an OutputStream. As a side effect the
    // working directory on the server is changed to the parent directory of the
    // file. The FTP client connection is closed when close() is called on the
    // FSDataOutputStream.
    client.changeWorkingDirectory(parent.toUri().getPath());
    FSDataOutputStream fos = new FSDataOutputStream(client.storeFileStream(file
        .getName()), statistics) {
      @Override
      public void close() throws IOException {
        super.close();
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.