K
katari
Hello,
I am doing a batch run, where I have several .csv files with the same
name in different sub-directories. At the end of the batch run, I want
to cat all the individual files together, and load them into the
database.
Here is the code:
Dir["**/store_need*"].each do |path|
single_file_nm = path.to_s
single_file = File.open("#{single_file_nm}", "r")
single_file.each do |line|
store_need_file << line
puts line
end
single_file.close
end
I am recursively looking for the store_need.csv files, and then
reading them into a single store_need_file. The problem is that this
code is not reading the file at all. I can see that the path is
defined correctly.
Any help is appreciated. I am running this on windows XP.
Kaushik
I am doing a batch run, where I have several .csv files with the same
name in different sub-directories. At the end of the batch run, I want
to cat all the individual files together, and load them into the
database.
Here is the code:
Dir["**/store_need*"].each do |path|
single_file_nm = path.to_s
single_file = File.open("#{single_file_nm}", "r")
single_file.each do |line|
store_need_file << line
puts line
end
single_file.close
end
I am recursively looking for the store_need.csv files, and then
reading them into a single store_need_file. The problem is that this
code is not reading the file at all. I can see that the path is
defined correctly.
Any help is appreciated. I am running this on windows XP.
Kaushik