List Files of Remote Directory
I have to dynamically select a file from a remote location based on the regular expression.
I used
FileUtils.listFiles(fileDirectory ,new RegexFileFilter("(" A.*")"),DirectoryFileFilter.DIRECTORY)
to list the files , this fails as it says that the parameter directory is not a directory.
I understand that the it is looking on the local system for the directory , Can anybody tell me as to how can I connect to the remote machine a开发者_如何学运维nd list the files at that location
If it is a complex task , can anybody please suggest a simple way to search for a file present on the remote location using regex.
Thanks Vivek
for ssh you can use jcraft.com/jsch (http://www.jcraft.com/jsch/examples/Sftp.java), for ftp - commons.apache.org/net (http://commons.apache.org/net/api-3.0/org/apache/commons/net/ftp/FTPClient.html)
精彩评论