开发者

List Files of Remote Directory

开发者 https://www.devze.com 2023-03-30 22:53 出处:网络
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.DIRECTO

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消