Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7014791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:34:03+00:00 2026-05-27T22:34:03+00:00

I have a problem with connection with FTP server. I have a application, which

  • 0

I have a problem with connection with FTP server. I have a application, which must read data from files. I have code where I searching files at my local disk, but I must change that because I have all data at FTP server.
At this time I using:

FileChannel fc = new FileInputStream("C:/Data/" + nameFile)
                    .getChannel();

where nameFile is name my file. I create channel where I load data from file from local disk. Can I change that code that I can search files at FTP server?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:34:03+00:00Added an answer on May 27, 2026 at 10:34 pm

    I don’t fully understand your post, but it sounds like you are looking for some code to check whether a file exists on the remote FTP server, correct? If so, then you will want to do the following:

    1. Connect to server and authenticate.

    2. Navigate to directory on remote system

    3. Perform a directory listing of remote system

    4. Check to see if any of the files in directory listing match the file you are looing for.

    I’ve done this successfully using Secure FTP Factory at http://www.jscape.com/products/components/java/secure-ftp-factory/

    Example Code

    Ftp ftp = new Ftp(hostname,username,pass);
    ftp.connect();
    
    // get directory listing
    
    Enumeration listing = ftp.getDirListing();
    
    // enumerate thru listing
    
    while(listing.hasMoreElements()) {
    
    FtpFile file = (FtpFile)listing.nextElement();
    
    // check to see if filename matches 
    System.out.println("Filename: " + file.getFilename());
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with connecting to Sql Server from my local machine. Seems like
I have a problem with making connection to local SQL server 2008 R2, here
My problem involves checking if I have a valid database connection before reading from
Actually I'm working on very simple FTP server. Now I have problem with sending
I have a problem with my connection tunneling. So I'm using two ubuntu server
I am downloading zip files from FTP server using PHP ftp function.I used binary
Does anyone have problem getting files from starteam using the cruise control tool for
i have a Problem using FTP connection on Android 2.2 devices. My app uses
I have problem with encoding in jQueryUI Autocomplete. Server side application is PHP and
I have a problem with mysql connection. I have a php script which upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.