Results 1 to 2 of 2
  1. #1
    doha786 is offline Member
    Join Date
    Mar 2009
    Posts
    48
    Rep Power
    0

    Arrow want to get File name....

    i need a small help to get file name or full path for output files of my program. so far my program is running as a search engine to find all of my friends name from many files and compare the similarity with a constructor "LCS".

    the part of my code:
    Java Code:
    FileReader reader; BufferedReader br;
    String result=""; String word= new String();
    String target = "friend";
    ArrayList names = new ArrayList();
    
    try{ //read many files from folder
    File directory = new File("C:/Users/Test");
    
    File file[]= directory.listFiles();
    
    for (File allFiles: file) {
    
    reader = new FileReader (allFiles);
    br = new BufferedReader(reader);
    Scanner scan = new Scanner(reader); 
    
    while(scan.hasNext()){ scan.next();
    result = scan.findWithinHorizon(target,0); 
    
    if(result!=null) {
    word = (scan.next() + scan.findWithinHorizon("", 0));
    
    names.add(word)
    for (String found: names){ } 
    
    }
    
    }
    scan.close();
    br.close();
    }
    Scanner scanner = new Scanner(System.in);
    String searchName;
    System.out.print("Enter name to Search : ");
    searchName = scanner.next();
    
    for (String found: names) {
    
    double compare = ReadFilesAndCompare.LCS(found, searchName);
    //if (compare >= 50.0) {
    System.out.println("Found names : "+found+ "\t" +"Similarity score: " +compare); }
    what should i use here to getFile name for my found result ??

    Can anybody please give a easiest solution for me ?
    Last edited by doha786; 04-05-2009 at 11:05 PM.

  2. #2
    doha786 is offline Member
    Join Date
    Mar 2009
    Posts
    48
    Rep Power
    0

    Default

    i want to make output like this :
    Found names: ..... Similarity score: ..... File name: ....

    right now just need to get file path or file name for my found names but i cant make it.
    Anybody can please help me ...

Similar Threads

  1. Replies: 2
    Last Post: 04-07-2009, 07:25 AM
  2. Replies: 0
    Last Post: 02-11-2009, 10:53 AM
  3. Replies: 7
    Last Post: 11-19-2008, 03:09 PM
  4. To open an image file such as Jpeg file using JAva Program
    By itmani2020 in forum Advanced Java
    Replies: 10
    Last Post: 07-11-2008, 10:57 AM
  5. Replies: 7
    Last Post: 05-23-2008, 04:46 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
  •