This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

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

 
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.


 
Saloon Keeper
Posts: 5344
143
  • 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.
 
Onion rings are vegetable donuts. Taste this tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!