lib/main.rb in echi-converter-0.3.7 vs lib/main.rb in echi-converter-0.3.8
- old
+ new
@@ -46,16 +46,21 @@
#Establish where to copy the processed files to
@processeddirectory = set_directory($workingdir)
Dir.entries(to_process_dir).each do | file |
- if file.slice(0,3) == 'chr'
- if $config["echi_format"] == 'BINARY'
- record_cnt = convert_binary_file file
- elsif $config["echi_format"] == 'ASCII'
- record_cnt = process_ascii file
+ if file.slice(0,3) == 'chr' && File.stat("#{to_process_dir}/#{file}").size == 0
+ @log.info "Encountered a zero bye chr file: #{file}"
+ FileUtils.mv("#{to_process_dir}/#{file}", @processeddirectory)
+ else
+ if file.slice(0,3) == 'chr'
+ if $config["echi_format"] == 'BINARY'
+ record_cnt = convert_binary_file file
+ elsif $config["echi_format"] == 'ASCII'
+ record_cnt = process_ascii file
+ end
+ @log.info "Processed file #{file} with #{record_cnt.to_s} records"
end
- @log.info "Processed file #{file} with #{record_cnt.to_s} records"
end
end
if $config["echi_process_dat_files"] == "Y" && $config["pco_process"] == "N"
process_dat_files
\ No newline at end of file