Win a copy of Microservices in Action this week in the Web Services 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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: 5051
135
  • 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!