Find out if a URL is a directory

Posted on 2006-05-02
Last Modified: 2010-08-05
I have a URL which, at least for now, is garanteed to be either a file:// or ftp:// reference.  I need some way of determining whether it is pointing to a file or a directory.  To be more exact I need to recurse the directory tree, but I have everything else written so this is the only issue.

Because of the possibility of it being an ftp I can't use the trick of converting the URL into a File and calling isDirectory.  Is there a universal way to do this, or will I have to parse the type and use different methods depending on the URL?
Question by:KurtVon
    LVL 86

    Accepted Solution

    LVL 11

    Author Comment

    So there isn't a clean universal way to access that information?

    Oh well.
    LVL 86

    Expert Comment

    No AFAIK


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    zeroFront challenge 7 58
    triangle challenge 4 41
    countPairs challenge 7 39
    Core Java. What output will be and why ? 6 41
    For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now