DirectoryScanner ds; if (action == SEND_FILES) { ds = fs.getDirectoryScanner(getProject()); } else { ds = new FTPDirectoryScanner(ftp); fs.setupDirectoryScanner(ds, getProject()); ds.setFollowSymlinks(fs.isFollowSymlinks()); ds.scan(); } String[] dsfiles = null; if (action == RM_DIR) { dsfiles = ds.getIncludedDirectories(); } else { dsfiles = ds.getIncludedFiles(); } String dir = null; if ((ds.getBasedir() == null) && ((action == SEND_FILES) || (action == GET_FILES))) { throw new BuildException("the dir attribute must be set for send " + "and get actions"); } else { if ((action == SEND_FILES) || (action == GET_FILES)) { dir = ds.getBasedir().getAbsolutePath(); } } // If we are doing a listing, we need the output stream created now. BufferedWriter bw = null; try { if (action == LIST_FILES) { File pd = listing.getParentFile(); if (!pd.exists()) { pd.mkdirs(); } bw = new BufferedWriter(new FileWriter(listing)); } RetryHandler h = new RetryHandler(this.retriesAllowed, this); if (action == RM_DIR) { // to remove directories, start by the end of the list // the trunk does not let itself be removed before the leaves for (int i = dsfiles.length - 1; i >= 0; i--) { final String dsfile = dsfiles[i]; executeRetryable(h, new Retryable() { public void execute() throws IOException { rmDir(ftp, dsfile); } }, dsfile); } } else { final BufferedWriter fbw = bw; final String fdir = dir; if (this.newerOnly) { this.granularityMillis = this.timestampGranularity.getMilliseconds(action); } for (int i = 0; i < dsfiles.length; i++) { final String dsfile = dsfiles[i]; executeRetryable(h, new Retryable() { public void execute() throws IOException { switch (action) { case SEND_FILES: sendFile(ftp, fdir, dsfile); break; case GET_FILES: getFile(ftp, fdir, dsfile); break; case DEL_FILES: delFile(ftp, dsfile); break; case LIST_FILES: listFile(ftp, fbw, dsfile); break; case CHMOD: doSiteCommand(ftp, "chmod " + chmod + " " + resolveFile(dsfile)); transferred++; break; default: throw new BuildException("unknown ftp action " + action); } } }, dsfile); } } } finally { FileUtils.close(bw); } return dsfiles.length;
DirectoryScanner ds; if (task.getAction() == FTPTask.SEND_FILES) { ds = fs.getDirectoryScanner(task.getProject()); } else { ds = new FTPDirectoryScanner(ftp); fs.setupDirectoryScanner(ds, task.getProject()); ds.setFollowSymlinks(fs.isFollowSymlinks()); ds.scan(); } String[] dsfiles = null; if (task.getAction() == FTPTask.RM_DIR) { dsfiles = ds.getIncludedDirectories(); } else { dsfiles = ds.getIncludedFiles(); } String dir = null; if ((ds.getBasedir() == null) && ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES))) { throw new BuildException("the dir attribute must be set for send " + "and get actions"); } else { if ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES)) { dir = ds.getBasedir().getAbsolutePath(); } } // If we are doing a listing, we need the output stream created now. BufferedWriter bw = null; try { if (task.getAction() == FTPTask.LIST_FILES) { File pd = task.getListing().getParentFile(); if (!pd.exists()) { pd.mkdirs(); } bw = new BufferedWriter(new FileWriter(task.getListing())); } RetryHandler h = new RetryHandler(task.getRetriesAllowed(), task); if (task.getAction() == FTPTask.RM_DIR) { // to remove directories, start by the end of the list // the trunk does not let itself be removed before the leaves for (int i = dsfiles.length - 1; i >= 0; i--) { final String dsfile = dsfiles[i]; executeRetryable(h, new Retryable() { public void execute() throws IOException { rmDir(ftp, dsfile); } }, dsfile); } } else { final BufferedWriter fbw = bw; final String fdir = dir; if (task.isNewer()) { task.setGranularityMillis(task.getTimestampGranularity() .getMilliseconds(task.getAction())); } for (int i = 0; i < dsfiles.length; i++) { final String dsfile = dsfiles[i]; executeRetryable(h, new Retryable() { public void execute() throws IOException { switch (task.getAction()) { case FTPTask.SEND_FILES: sendFile(ftp, fdir, dsfile); break; case FTPTask.GET_FILES: getFile(ftp, fdir, dsfile); break; case FTPTask.DEL_FILES: delFile(ftp, dsfile); break; case FTPTask.LIST_FILES: listFile(ftp, fbw, dsfile); break; case FTPTask.CHMOD: doSiteCommand(ftp, "chmod " + task.getChmod() + " " + resolveFile(dsfile)); transferred++; break; default: throw new BuildException("unknown ftp action " + task.getAction()); } } }, dsfile); } } } finally { if (bw != null) { bw.close(); } //FileUtils.close(bw); } return dsfiles.length;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.9.0/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java File path: /apache-ant-1.9.0/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
Method name: int transferFiles(FTPClient, FileSet) Method name: int transferFiles(FTPClient, FileSet)
Number of AST nodes: 36 Number of AST nodes: 36
1
DirectoryScanner ds;
1
DirectoryScanner ds;
2
        if (action == SEND_FILES) {
2
        if (task.getAction() == FTPTask.SEND_FILES) {
3
            ds = fs.getDirectoryScanner(getProject());
3
            ds = fs.getDirectoryScanner(task.getProject());
4
        } else {
4
        } else {
5
            ds = new FTPDirectoryScanner(ftp);
5
            ds = new FTPDirectoryScanner(ftp);
6
            fs.setupDirectoryScanner(ds, getProject());
6
            fs.setupDirectoryScanner(ds, task.getProject());
7
            ds.setFollowSymlinks(fs.isFollowSymlinks());
7
            ds.setFollowSymlinks(fs.isFollowSymlinks());
8
            ds.scan();
8
            ds.scan();
9
        }
9
        }
10
        String[] dsfiles = null;
10
        String[] dsfiles = null;
11
        if (action == RM_DIR) {
11
        if (task.getAction() == FTPTask.RM_DIR) {
12
            dsfiles = ds.getIncludedDirectories();
12
            dsfiles = ds.getIncludedDirectories();
13
        } else {
13
        } else {
14
            dsfiles = ds.getIncludedFiles();
14
            dsfiles = ds.getIncludedFiles();
15
        }
15
        }
16
        String dir = null;
16
        String dir = null;
17
        if ((ds.getBasedir() == null)
17
        if ((ds.getBasedir() == null)
18
            && ((action == SEND_FILES) || (action == GET_FILES))) {
18
            && ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES))) {
19
            throw new BuildException("the dir attribute must be set for send "
19
            throw new BuildException("the dir attribute must be set for send "
20
                                     + "and get actions");
20
                                     + "and get actions");
21
        } else {
21
        } else {
22
            if ((action == SEND_FILES) || (action == GET_FILES)) {
22
            if ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES)) {
23
                dir = ds.getBasedir().getAbsolutePath();
23
                dir = ds.getBasedir().getAbsolutePath();
24
            }
24
            }
25
        }
25
        }
26
        // If we are doing a listing, we need the output stream created now.
26
        // If we are doing a listing, we need the output stream created now.
27
        BufferedWriter bw = null;
27
        BufferedWriter bw = null;
28
        try {
28
        try {
29
            if (action == LIST_FILES) {
29
            if (task.getAction() == FTPTask.LIST_FILES) {
30
                File pd = listing.getParentFile();
30
                File pd = task.getListing().getParentFile();
31
                if (!pd.exists()) {
31
                if (!pd.exists()) {
32
                    pd.mkdirs();
32
                    pd.mkdirs();
33
                }
33
                }
34
                bw = new BufferedWriter(new FileWriter(listing));
34
                bw = new BufferedWriter(new FileWriter(task.getListing()));
35
            }
35
            }
36
            RetryHandler h = new RetryHandler(this.retriesAllowed, this);
36
            RetryHandler h = new RetryHandler(task.getRetriesAllowed(), task);
37
            if (action == RM_DIR) {
37
            if (task.getAction() == FTPTask.RM_DIR) {
38
                // to remove directories, start by the end of the list
38
                // to remove directories, start by the end of the list
39
                // the trunk does not let itself be removed before the leaves
39
                // the trunk does not let itself be removed before the leaves
40
                for (int i = dsfiles.length - 1; i >= 0; i--) {
40
                for (int i = dsfiles.length - 1; i >= 0; i--) {
41
                    final String dsfile = dsfiles[i];
41
                    final String dsfile = dsfiles[i];
42
                    executeRetryable(h, new Retryable() {
42
                    executeRetryable(h, new Retryable() {
43
                            public void execute() throws IOException {
43
                            public void execute() throws IOException {
44
                                rmDir(ftp, dsfile);
44
                                rmDir(ftp, dsfile);
45
                            }
45
                            }
46
                        }, dsfile);
46
                        }, dsfile);
47
                }
47
                }
48
            } else {
48
            } else {
49
                final BufferedWriter fbw = bw;
49
                final BufferedWriter fbw = bw;
50
                final String fdir = dir;
50
                final String fdir = dir;
51
                if (this.newerOnly) {
51
                if (task.isNewer()) {
52
                    this.granularityMillis =
52
                    task.setGranularityMillis
53
                        this.timestampGranularity
53
(task.getTimestampGranularity()
54
.getMilliseconds(action);
54
                                              .getMilliseconds(task.getAction()));
55
                }
55
                }
56
                for (int i = 0; i < dsfiles.length; i++) {
56
                for (int i = 0; i < dsfiles.length; i++) {
57
                    final String dsfile = dsfiles[i];
57
                    final String dsfile = dsfiles[i];
58
                    executeRetryable(h, new Retryable() {
58
                    executeRetryable(h, new Retryable() {
59
                            public void execute() throws IOException {
59
                            public void execute() throws IOException {
60
                                switch (action) {
60
                                switch (task.getAction()) {
61
                                case SEND_FILES:
61
                                case FTPTask.SEND_FILES:
62
                                    sendFile(ftp, fdir, dsfile);
62
                                    sendFile(ftp, fdir, dsfile);
63
                                    break;
63
                                    break;
64
                                case GET_FILES:
64
                                case FTPTask.GET_FILES:
65
                                    getFile(ftp, fdir, dsfile);
65
                                    getFile(ftp, fdir, dsfile);
66
                                    break;
66
                                    break;
67
                                case DEL_FILES:
67
                                case FTPTask.DEL_FILES:
68
                                    delFile(ftp, dsfile);
68
                                    delFile(ftp, dsfile);
69
                                    break;
69
                                    break;
70
                                case LIST_FILES:
70
                                case FTPTask.LIST_FILES:
71
                                    listFile(ftp, fbw, dsfile);
71
                                    listFile(ftp, fbw, dsfile);
72
                                    break;
72
                                    break;
73
                                case CHMOD:
73
                                case FTPTask.CHMOD:
74
                                    doSiteCommand(ftp, "chmod " + chmod
74
                                    doSiteCommand(ftp, "chmod " + task.getChmod() + " "
75
                                                  + " " + resolveFile(dsfile));
75
                                                  + resolveFile(dsfile));
76
                                    transferred++;
76
                                    transferred++;
77
                                    break;
77
                                    break;
78
                                default:
78
                                default:
79
                                    throw new BuildException("unknown ftp action " + a
79
                                    throw new BuildException("unknown ftp action "
80
ction);
80
                                                             + task.getAction());
81
                                }
81
                                }
82
                            }
82
                            }
83
                        }, dsfile);
83
                        }, dsfile);
84
                }
84
                }
85
            }
85
            }
86
        } finally {
86
        } finally {
87
            
87
            if (bw != null) {
88
                bw.close();
89
            }
88
FileUtils.close(bw);
90
        	//FileUtils.close(bw);
89
        }
91
        }
90
        return dsfiles.length;
92
        return dsfiles.length;
Summary
Number of common nesting structure subtrees2
Number of refactorable cases1
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)115.8
Clones locationClones are in different classes
Number of node comparisons203
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements17
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)50.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    19
    if (action == LIST_FILES)
    19
    if (action == LIST_FILES)
    19
    if (task.getAction() == FTPTask.LIST_FILES)
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    LIST_FILESFTPTask.LIST_FILESTYPE_COMPATIBLE_REPLACEMENT
    19
    if (task.getAction() == FTPTask.LIST_FILES)
    20
    File pd = listing.getParentFile();
    20
    File pd = listing.getParentFile();
    20
    File pd = task.getListing().getParentFile();
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    listingtask.getListing()FIELD_ACCESS_REPLACED_WITH_GETTER
    20
    File pd = task.getListing().getParentFile();
    21
    if (!pd.exists())
    21
    if (!pd.exists())
    22
    pd.mkdirs();
    22
    pd.mkdirs();
    23
    bw = new BufferedWriter(new FileWriter(listing));
    23
    bw = new BufferedWriter(new FileWriter(listing));
    23
    bw = new BufferedWriter(new FileWriter(task.getListing()));
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    listingtask.getListing()FIELD_ACCESS_REPLACED_WITH_GETTER
    23
    bw = new BufferedWriter(new FileWriter(task.getListing()));
    24
    RetryHandler h = new RetryHandler(this.retriesAllowed, this);
    24
    RetryHandler h = new RetryHandler(this.retriesAllowed, this);
    24
    RetryHandler h = new RetryHandler(task.getRetriesAllowed(), task);
    Differences
    Expression1Expression2Difference
    thistaskTYPE_COMPATIBLE_REPLACEMENT
    this.retriesAllowedtask.getRetriesAllowed()FIELD_ACCESS_REPLACED_WITH_GETTER
    thistaskTYPE_COMPATIBLE_REPLACEMENT
    24
    RetryHandler h = new RetryHandler(task.getRetriesAllowed(), task);
    25
    if (action == RM_DIR)
    25
    if (action == RM_DIR)
    25
    if (task.getAction() == FTPTask.RM_DIR)
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    RM_DIRFTPTask.RM_DIRTYPE_COMPATIBLE_REPLACEMENT
    25
    if (task.getAction() == FTPTask.RM_DIR)
    26
    for (int i = dsfiles.length - 1; i >= 0; i--)
    26
    for (int i = dsfiles.length - 1; i >= 0; i--)
    27
    final String dsfile = dsfiles[i];
    27
    final String dsfile = dsfiles[i];
    28
    executeRetryable(h, new Retryable() {...}, dsfile);
    28
    executeRetryable(h, new Retryable() {...}, dsfile);
    else
    else
    29
    final BufferedWriter fbw = bw;
    29
    final BufferedWriter fbw = bw;
    30
    final String fdir = dir;
    30
    final String fdir = dir;
    31
    if (this.newerOnly)
    31
    if (this.newerOnly)
    31
    if (task.isNewer())
    Differences
    Expression1Expression2Difference
    thistaskTYPE_COMPATIBLE_REPLACEMENT
    this.newerOnlytask.isNewer()FIELD_ACCESS_REPLACED_WITH_GETTER
    31
    if (task.isNewer())
    32
    this.granularityMillis = this.timestampGranularity.getMilliseconds(action);
    32
    this.granularityMillis = this.timestampGranularity.getMilliseconds(action);
    32
    task.setGranularityMillis(task.getTimestampGranularity().getMilliseconds(task.getAction()));
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    this.timestampGranularitytask.getTimestampGranularity()TYPE_COMPATIBLE_REPLACEMENT
    thistaskTYPE_COMPATIBLE_REPLACEMENT
    this.granularityMillis=this.timestampGranularity.getMilliseconds(action)task.setGranularityMillis(task.getTimestampGranularity().getMilliseconds(task.getAction()))FIELD_ASSIGNMENT_REPLACED_WITH_SETTER
    32
    task.setGranularityMillis(task.getTimestampGranularity().getMilliseconds(task.getAction()));
    33
    for (int i = 0; i < dsfiles.length; i++)
    33
    for (int i = 0; i < dsfiles.length; i++)
    34
    final String dsfile = dsfiles[i];
    34
    final String dsfile = dsfiles[i];
    35
    executeRetryable(h, new Retryable() {...}, dsfile);
    35
    executeRetryable(h, new Retryable() {...}, dsfile);
    35
    executeRetryable(h, new Retryable() {...}, dsfile);
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    SEND_FILESFTPTask.SEND_FILESTYPE_COMPATIBLE_REPLACEMENT
    GET_FILESFTPTask.GET_FILESTYPE_COMPATIBLE_REPLACEMENT
    DEL_FILESFTPTask.DEL_FILESTYPE_COMPATIBLE_REPLACEMENT
    LIST_FILESFTPTask.LIST_FILESTYPE_COMPATIBLE_REPLACEMENT
    CHMODFTPTask.CHMODTYPE_COMPATIBLE_REPLACEMENT
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    chmodtask.getChmod()FIELD_ACCESS_REPLACED_WITH_GETTER
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    35
    executeRetryable(h, new Retryable() {...}, dsfile);
    Precondition Violations (0)
    Row Violation
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)109.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    DirectoryScanner ds;
    1
    DirectoryScanner ds;
    2
    if (action == SEND_FILES)
    2
    if (action == SEND_FILES)
    2
    if (task.getAction() == FTPTask.SEND_FILES)
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    SEND_FILESFTPTask.SEND_FILESTYPE_COMPATIBLE_REPLACEMENT
    2
    if (task.getAction() == FTPTask.SEND_FILES)
    3
    ds = fs.getDirectoryScanner(getProject());
    3
    ds = fs.getDirectoryScanner(getProject());
    3
    ds = fs.getDirectoryScanner(task.getProject());
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    3
    ds = fs.getDirectoryScanner(task.getProject());
    else
    else
    4
    ds = new FTPDirectoryScanner(ftp);
    4
    ds = new FTPDirectoryScanner(ftp);
    4
    ds = new FTPDirectoryScanner(ftp);
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.optional.net.FTP.FTPDirectoryScannerorg.apache.tools.ant.taskdefs.optional.net.FTPTaskMirrorImpl.FTPDirectoryScannerSUBCLASS_TYPE_MISMATCH
    4
    ds = new FTPDirectoryScanner(ftp);
    5
    fs.setupDirectoryScanner(ds, getProject());
    5
    fs.setupDirectoryScanner(ds, getProject());
    5
    fs.setupDirectoryScanner(ds, task.getProject());
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    5
    fs.setupDirectoryScanner(ds, task.getProject());
    6
    ds.setFollowSymlinks(fs.isFollowSymlinks());
    6
    ds.setFollowSymlinks(fs.isFollowSymlinks());
    7
    ds.scan();
    7
    ds.scan();
    8
    String[] dsfiles = null;
    8
    String[] dsfiles = null;
    9
    if (action == RM_DIR)
    9
    if (action == RM_DIR)
    9
    if (task.getAction() == FTPTask.RM_DIR)
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    RM_DIRFTPTask.RM_DIRTYPE_COMPATIBLE_REPLACEMENT
    9
    if (task.getAction() == FTPTask.RM_DIR)
    10
    dsfiles = ds.getIncludedDirectories();
    10
    dsfiles = ds.getIncludedDirectories();
    else
    else
    11
    dsfiles = ds.getIncludedFiles();
    11
    dsfiles = ds.getIncludedFiles();
    12
    String dir = null;
    12
    String dir = null;
    13
    if ((ds.getBasedir() == null) && ((action == SEND_FILES) || (action == GET_FILES)))
    13
    if ((ds.getBasedir() == null) && ((action == SEND_FILES) || (action == GET_FILES)))
    13
    if ((ds.getBasedir() == null) && ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES)))
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    SEND_FILESFTPTask.SEND_FILESTYPE_COMPATIBLE_REPLACEMENT
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    GET_FILESFTPTask.GET_FILESTYPE_COMPATIBLE_REPLACEMENT
    13
    if ((ds.getBasedir() == null) && ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES)))
    14
    throw new BuildException("the dir attribute must be set for send " + "and get actions");
    14
    throw new BuildException("the dir attribute must be set for send " + "and get actions");
    else
    else
    15
    if ((action == SEND_FILES) || (action == GET_FILES))
    15
    if ((action == SEND_FILES) || (action == GET_FILES))
    15
    if ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES))
    Differences
    Expression1Expression2Difference
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    SEND_FILESFTPTask.SEND_FILESTYPE_COMPATIBLE_REPLACEMENT
    taskMISSING_METHOD_INVOCATION_EXPRESSION
    actiontask.getAction()FIELD_ACCESS_REPLACED_WITH_GETTER
    GET_FILESFTPTask.GET_FILESTYPE_COMPATIBLE_REPLACEMENT
    15
    if ((task.getAction() == FTPTask.SEND_FILES) || (task.getAction() == FTPTask.GET_FILES))
    16
    dir = ds.getBasedir().getAbsolutePath();
    16
    dir = ds.getBasedir().getAbsolutePath();
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables dsfiles, dir , while Clone fragment #2 returns variables dsfiles, dir