This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

check values in a csv file in all files in a directory  RSS feed

 
prince davies
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ihave a csv file, it has 1000 values, I have to take each value in the csv file and check whether that value is there any of the files in folders of a directory.

How do I do that? Is anybody implemeted this code?

I used below code, it does not work for me, it gives me IO Error Occurred: java.io.FileNotFoundException: C:\myfile\100_5720 (Access is denied) , it throws

 
prince davies
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have not added code for reading csv file and getting each value from it , loop thru the files in the folders. in my question, i hardcoded one value = believe
 
prince davies
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I used the following code for checking values in csv file in fles in folders in a directory. But it throws an exception










why does it thow file not found excption : (Access is denied)
 
prince davies
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


searchFile = new BufferedReader(new FileReader(f));

problem is @ new FileReader(f)

the above line returned me java.io.FileNotFoundException: C:\PROJECTS\CODE\2012-JULY-DEV\vobs\src\sdt\source\java\com (Access is denied)

it could read first file. but this is a folder with no file in it.
 
prince davies
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have run the following program, its working fine now. I want to know how I can optimize this program. Please help me ASAP.


 
Tim Moores
Saloon Keeper
Posts: 3888
91
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simple though it is, there's more to CSV than what code implements. If this was my problem I'd use a CSV library like the ones listed in the http://www.coderanch.com/how-to/java/AccessingFileFormats page.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!