Hi All,
 
  I know its wrong to ask java question in servlet-interest but still i doing this because it is urgent.  I have a problem in parsing a string.  It is like this:
 
  I am developing a file search program in java, it is just a part of my module.  It should do some thing like this if you give file name as parameter to this program it should search through your hard disk and give you all information regarding the file for example - file name, file size, date of last modification, file belongs to which user etc. 
 
  What i did right now is, i used Process and Runtime class to run my command "dir filename /s" which of course returned me the output of the command.  It is something like this :
 
C:\>dir whenever.mp3 /s
 Volume in drive C has no label.
 Volume Serial Number is 2143-080A
 

 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
 
C:\>
 
  I got the above output in a string called [ cmdOutput ].  What i really want is to get only [ c:\ ]  and [ c:\mp3 ] and put them in a Vector. So now this vector has only 2 elements - c:\ and c:\mp3. 
 
  What i will do afterwards is i will join c:\ with the filename [ whenever.mp3 ] pass it to File class and get all the information, same applies to c:\mp3.
 
  The above is just a sample but actual file search can return a lot of Directory name.
 
  You can also suggest me some other way of retrieving file information and storing it in an Vector or Hashtable.
 
  Looking forward for yours early response.
 
  With Regards,
 
karthikeyan.
 
 
 
 
 

Reply via email to