Package org.apache.commons.net.ftp

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


    {
        try
        {
            updateLastAccessed();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
View Full Code Here


        }
        catch (IOException e)
        {
            disconnect();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
View Full Code Here

  }

  @Override
  public FSDataInputStream open(Path file, int bufferSize) throws IOException {
    FTPClient client = connect();
    Path workDir = new Path(client.printWorkingDirectory());
    Path absolute = makeAbsolute(workDir, file);
    FileStatus fileStat = getFileStatus(client, absolute);
    if (fileStat.isDirectory()) {
      disconnect(client);
      throw new FileNotFoundException("Path " + file + " is a directory.");
View Full Code Here

  @Override
  public FSDataOutputStream create(Path file, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize,
      Progressable progress) throws IOException {
    final FTPClient client = connect();
    Path workDir = new Path(client.printWorkingDirectory());
    Path absolute = makeAbsolute(workDir, file);
    FileStatus status;
    try {
      status = getFileStatus(client, file);
    } catch (FileNotFoundException fnfe) {
View Full Code Here

  @Override
  public Path getHomeDirectory() {
    FTPClient client = null;
    try {
      client = connect();
      Path homeDir = new Path(client.printWorkingDirectory());
      return homeDir;
    } catch (IOException ioe) {
      throw new FTPException("Failed to get home directory", ioe);
    } finally {
      try {
View Full Code Here

        FTPClient client = getClient();
        String[] pathes = getPath().replaceAll("\\\\", "/").split("/");
        boolean find = false;
        if (pathes.length > 0) {
            for (int i = 0; i < pathes.length - 1; i++){
                log.trace("Ftp client: we at: " + client.printWorkingDirectory() + ", go to \'" + pathes[i] + "'");
                int reply = client.cwd(pathes[i]);
                if (reply >= 400) {
                    log.warn("exist cwd " + pathes[i] + " responce code : " + client.getReplyCode() + ", reply: " + client.getReplyString());
                    return false;
                }
View Full Code Here

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

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

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

  }

  @Override
  public FSDataInputStream open(Path file, int bufferSize) throws IOException {
    FTPClient client = connect();
    Path workDir = new Path(client.printWorkingDirectory());
    Path absolute = makeAbsolute(workDir, file);
    FileStatus fileStat = getFileStatus(client, absolute);
    if (fileStat.isDirectory()) {
      disconnect(client);
      throw new IOException("Path " + file + " is a directory.");
View Full Code Here

  @Override
  public FSDataOutputStream create(Path file, FsPermission permission,
      boolean overwrite, int bufferSize, short replication, long blockSize,
      Progressable progress) throws IOException {
    final FTPClient client = connect();
    Path workDir = new Path(client.printWorkingDirectory());
    Path absolute = makeAbsolute(workDir, file);
    if (exists(client, file)) {
      if (overwrite) {
        delete(client, file);
      } else {
View Full Code Here

  @Override
  public Path getHomeDirectory() {
    FTPClient client = null;
    try {
      client = connect();
      Path homeDir = new Path(client.printWorkingDirectory());
      return homeDir;
    } catch (IOException ioe) {
      throw new FTPException("Failed to get home directory", ioe);
    } finally {
      try {
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.