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.service;
21
22 import org.waarp.common.command.exception.CommandAbstractException;
23 import org.waarp.ftp.core.command.AbstractCommand;
24
25 import java.util.List;
26
27
28
29
30 public class NLST extends AbstractCommand {
31 @Override
32 public final void exec() throws CommandAbstractException {
33 final String path;
34 final List<String> files;
35 if (!hasArg()) {
36 path = getSession().getDir().getPwd();
37 files = getSession().getDir().list(path);
38 } else {
39 path = getArg();
40 if (path.startsWith("-l") || path.startsWith("-L")) {
41
42 final String[] paths = getArgs();
43 if (paths.length > 1) {
44 files = getSession().getDir().listFull(paths[1], true);
45 } else {
46 files = getSession().getDir()
47 .listFull(getSession().getDir().getPwd(), true);
48 }
49 } else {
50 files = getSession().getDir().list(path);
51 }
52 }
53 getSession().openDataConnection();
54 getSession().getDataConn().getFtpTransferControl()
55 .setNewFtpTransfer(getCode(), files, path);
56 }
57
58 }