Vivek
Vivek

Reputation: 2101

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 and 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

Upvotes: 0

Views: 5266

Answers (1)

dchekmarev
dchekmarev

Reputation: 459

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)

Upvotes: 2

Related Questions