File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

List Files of Remote Directory

 
Vivek Sam
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have a requirement to dynamically select a file from a remote location based on the regular expression.

Now i used to list the files , this fails as it says that the parameter directory is not a directory.

Now 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
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Certainly too difficult for us on "beginning". Maybe the "in General" people will be able to cope
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We don't know anything about the network which includes your computer and this remote directory, so we can only guess.

Okay. My guess is that maybe you can map a drive to this remote directory before you run the code.
 
H Paul
Ranch Hand
Posts: 471
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I take this as an opportunity to learn new way of doing this.

Without any technical environment/constraint, here is my guess:

My guess: May or not work

Use FTPClient

FTPFile[] listFiles(String pathname, FTPFileFilter filter)
Version of listFiles(String) which allows a filter to be provided.

And implement FTPFileFilter
 
Vivek Sam
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Resolved the issue by using JSch , basically a SFTP connection to the Remote machine.

Please refer the below links for example and the home page of the same.

JSch Home Page

JSch SFTP Example

Thanks to all for their replies.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic