Package org.apache.commons.net.ftp

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


      String name1 = "/FTPdir1";
     
      // Create folder by mkdir FTP command
      ftp.makeDirectory(name1);
     
      ftp.changeWorkingDirectory(name1);
     
      assertEmptyDirectory(ftp);
     
      String newWorkingDirectory = ftp.printWorkingDirectory();
      assertEquals(name1, newWorkingDirectory);
View Full Code Here


      assertEmptyDirectory(ftp);
     
      String newWorkingDirectory = ftp.printWorkingDirectory();
      assertEquals(name1, newWorkingDirectory);
     
      ftp.changeWorkingDirectory("/");
     
      newWorkingDirectory = ftp.printWorkingDirectory();
      assertEquals("/", newWorkingDirectory);

      ftp.disconnect();
View Full Code Here

        url = message.getURL();
        final FTPClient ftp = createFTP();
        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 = new FilterInputStream(ftp.retrieveFileStream(file)) {

            public void close() throws IOException {
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

            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

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.