Results 1 to 7 of 7

Thread: Determine # of files inside a directory

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    20

    Determine # of files inside a directory

    Dear CornedBee.
    Thanks for ur help. but is there a way for the system to determine the path on its own without specifying the path, eg.
    c:\\java\project ?????

    Tq,
    Neptune.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Huh?

    Which path do you want?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    20
    let me explain more detail. that day u give me a solution to determine # files in a directory.
    here it is:
    java.io.File dir = new java.io.File("c:\\java\project");
    int count = dir.list().length;

    "c:\\java\project" is the pathname right?

    so, is there anyway for the system to know the path without us typing this-->"c:\\java\project" by the time the above 2 codes is being executed?

    hope u can read me.

    Sincerely;
    Nepunel.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Which path name? I think there is a File.getCwd or something to get the current directory, which may or may not be what you want.

    However, in this sentence
    "for the system to know the path "
    "the path" refers to nothing. Sorry, semantic error, I can't compile your sentence to brain code
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    20
    Haha. i m so sorry.

    i think the File.getCwd is wat i want. i just want to know the current directory in a drive.

    Let say computer A and B.
    inside A, user compile and run its java file inside c:\\java\project

    meanwhile inside B. another user run its java file inside d:\\assignment

    so, this 2 directory is totally different right? therefore, it'll be meaningless to specify the pathname like c:\\java\project inside my pc(let say C) as it gives no meaning for computer B?

    hope u understand as i also

    Neptune.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jul 2003
    Posts
    20
    if possible, can i hav ur contact like icq#?

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    70788560

    And I found this (was tricky...)
    http://java.sun.com/j2se/1.4.2/docs/api/index.html
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width