Skip to content

Commit 7fccfce

Browse files
committed
NET-244 Add support for FTPFileFilter filters to FTPClient
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/net/branches/NET_2_0@963340 13f79535-47bb-0310-9956-ffa450edef68
1 parent 045baf9 commit 7fccfce

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main/java/org/apache/commons/net/ftp/FTPClient.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,6 +2270,22 @@ public FTPFile[] listFiles()
22702270
return listFiles((String) null);
22712271
}
22722272

2273+
/**
2274+
* Version of {@link #listFiles(String)} which allows a filter to be provided.
2275+
* For example: <code>listFiles("site", FTPFileFilters.DIRECTORY);</code>
2276+
* @param pathname the initial path, may be null
2277+
* @param filter the filter, non-null
2278+
* @return the list of FTPFile entries.
2279+
* @throws IOException
2280+
*/
2281+
public FTPFile[] listFiles(String pathname, FTPFileFilter filter)
2282+
throws IOException
2283+
{
2284+
FTPListParseEngine engine = initiateListParsing((String) null, pathname);
2285+
return engine.getFiles(filter);
2286+
2287+
}
2288+
22732289
/**
22742290
* Using the default autodetect mechanism, initialize an FTPListParseEngine
22752291
* object containing a raw file information for the current working

0 commit comments

Comments
 (0)