title: Ftp Client-Server, my 'cd ..' command messes up my 'pwd' command
body: <p>On my client-side, if I cd into a directory and pwd it, it'll show me the correct pwd. (ftp> means client-side)</p>
  
  <pre><code>ftp&gt; cd adam
  ftp&gt; pwd
  remote working directory: amlodoz1/p1/adam
  </code></pre>
  
  <p>But if I then 'cd ..' out of it, and hit pwd, it gives me this:</p>
  
  <pre><code>ftp&gt; cd ..
  ftp&gt; pwd
  remote working directory: amlodoz1/p1/adam/..
  </code></pre>
  
  <p>Obviously, pwd should return <code>amlodoz1/p1/</code> but it just likes to append whatever characters I cd into to the pathname.</p>
  
  <p>My implementation for 'cd' and 'pwd' are here.</p>
  
  <pre><code>    public void cd(String dirName) throws IOException{
              System.out.println("Changing directory to '" + dirName + "'");
              File dir = new File(dirName);
              System.setProperty("user.dir", dir.getAbsolutePath());
      }
  
      public void pwd() throws IOException{
              String pwd = System.getProperty("user.dir");
              System.out.println("Remote working directory: " + pwd);
      }
  </code></pre>
  
  <p>I was thinking about writing an if clause for 'cd ..' but I don't know what I would set the "user.dir" to in the setProperty function.</p>