• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

List Files of Remote Directory

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Certainly too difficult for us on "beginning". Maybe the "in General" people will be able to cope
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic