1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.waarp.ftp.core.command.directory;
21
22 import org.waarp.common.command.ReplyCode;
23 import org.waarp.common.command.exception.CommandAbstractException;
24 import org.waarp.common.command.exception.Reply530Exception;
25 import org.waarp.ftp.core.command.AbstractCommand;
26 import org.waarp.ftp.core.file.FtpDir;
27
28
29
30
31 public class CDUP extends AbstractCommand {
32 @Override
33 public final void exec() throws CommandAbstractException {
34 final FtpDir current = getSession().getDir();
35 if (current == null) {
36 throw new Reply530Exception("Not authentificated");
37 }
38 if (current.changeParentDirectory()) {
39 getSession().setReplyCode(ReplyCode.REPLY_250_REQUESTED_FILE_ACTION_OKAY,
40 '"' + current.getPwd() +
41 "\" is the new current directory");
42 } else {
43 getSession().setReplyCode(ReplyCode.REPLY_550_REQUESTED_ACTION_NOT_TAKEN,
44 null);
45 }
46 }
47
48 }