Results 1 to 2 of 2
  1. #1
    renu is offline Senior Member
    Join Date
    May 2010
    Posts
    117
    Rep Power
    0

    Question How to get the filename from a directory path. Their is only one file in the director

    Hi

    I see code for listing all the files present in a directory.

    I my directory path, Their is only one file, how to get the file name from the path and read the file, (Please tell me how to get the name of the only file in the directory?)

    by checking if it is readable ( I know this part).




    Thank You.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,759
    Rep Power
    19

    Default Re: How to get the filename from a directory path. Their is only one file in the dire

    Here's the File API.
    This has all the methods for getting a List<File> for a directory, and the name of a file.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. how can i get directory path without select any file ?
    By amr magdy in forum New To Java
    Replies: 1
    Last Post: 12-29-2011, 11:52 AM
  2. Replies: 6
    Last Post: 10-11-2011, 09:48 PM
  3. I need to set new directory path in tomcat
    By Mayank Joshi in forum Java Servlet
    Replies: 2
    Last Post: 05-05-2010, 12:16 PM
  4. Replies: 4
    Last Post: 04-03-2010, 06:20 PM
  5. Reading a directory and getting the filename
    By mrjunsy in forum Advanced Java
    Replies: 1
    Last Post: 05-10-2008, 02:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •