Hi,

  Thanx for your guys help.  I have also seen this example from Thinking in
Java and i know how to retrieve file information but then my requirement is
just to get :

- [directory name] which will be shown when we execute dir filename /s, this
i am doing programmatically using Runtime class exec command and i some how
get the result of the search in a String.  Since i am doing a file search
operation i am using this particular command to retrieve those file
location, once i get that location then i can get all the information of
those files.  Code is like this :


String filename = "wherever.mp3";
Runtime r = Runtime.getRuntime();
Process p = r.exec("dir " + filename + " /s");
BufferedReader kbdInput =
  new BufferedReader(new InputStreamReader(p.getInputStream()));
String cmdOutput;
while((cmdOutput = kbdInput.readLine()) != null)
  System.out.println(line);

now when i print [ String line ] i get output something like this:

Directory of C:\

12/30/01  07:54p             3,174,400 whenever.mp3
               1 File(s)      3,174,400 bytes

Directory of C:\mp3

12/30/01  07:54p             3,174,400 whenever.mp3
               1 File(s)      3,174,400 bytes

     Total Files Listed:
               2 File(s)      6,348,800 bytes
                             959,447,040 bytes free

from this output i just need

1. c:\ - directory name for the first result.
2. c:\mp3 - directory name for the second result.

  Since there is no delimiters in the above output and there is no
consistency in spacing i having problem in retrieving the above directory
names.

  Guys i am also trying.

  Looking forward for your response  and  wish you all a Happy and
Prosperous New Year 2002.

  With Regards,

karthikeyan.

Reply via email to