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 9168527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:38:46+00:00 2026-06-17T15:38:46+00:00

So I have this FTP server with a bunch of folders and files inside.

  • 0

So I have this FTP server with a bunch of folders and files inside.

My program needs to access this server, read all of the files, and display their data.

For development purposes I’ve been working with the files on my hard drive, right in the “src” folder.

But now that the server is up and running, I need to connect the software to it.

Basically what I want to do is get a list of the Files in a particular folder on the server.

This is what I have so far:

URL url = null;
File folder = null;
try {
    url = new URL ("ftp://username:password@www.superland.example/server");
    folder = new File (url.toURI());
} catch (Exception e) {
    e.printStackTrace();
}
data = Arrays.asList(folder.listFiles(new FileFilter () {
    public boolean accept(File file) {
        return file.isDirectory();
    }
}));

But I get the error “URI scheme is not ‘file’.”

I understand this is because my URL starts with “ftp://” and not “file:”

However I can’t seem to figure out what I’m supposed to do about it!

Maybe there’s a better way to go about this?

  • 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-06-17T15:38:47+00:00Added an answer on June 17, 2026 at 3:38 pm

    File objects cannot handle an FTP connection, you need to use a URLConnection:

    URL url = new URL ("ftp://username:password@www.superland.example/server");
    URLConnection urlc = url.openConnection();
    InputStream is = urlc.getInputStream();
    ...
    

    Consider as an alternative FTPClient from Apache Commons Net which has support for many protocols. Here is an FTP list files example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this method to transfer files using a FTP Server: private void TransferNeededFiles(IEnumerable<string>
I know how to read text file from the ftp server.I have used this
I have xml files been imported onto an FTP server. This is stored in
I have this scenario. OS is UNIX. There are a bunch of files on
currently I'm working on this ftp transfer. http://msdn.microsoft.com/en-us/library/ms229715.aspx I have setup my server computers
I already have code for a ftp server. I am following this code. Now
Okay so this is lame but I have a file/ftp server that serves the
I'm desperately trying to solve this one. I have a bunch of files stored
I have a bunch of files that I am transferring to a single FTP
i have a ftp server that uses a serve_forever command. this ftp service is

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.