S
Sasaki
hi guys,
How can i determine the file type?
I have to do these actions:
1. I have tor read all files from a directory and check them
2.after checking i have to read only the excel files.
I have tried with the code..
initial_dir = ["./upload_dir"]
for dir in initial_dir
Find.find(dir)do |path|
files_list << path
file_part= path.split('/')
file_type=file_part[1].split('.')
if(file_type[1]=='xls')
read the file
end
end
end
error is "Exception: Permission denied - ./upload_dir"
probably, the code also try to process the "../" and "./"
So how can i check the file type.
please help me waiting for ur response
Sasaki
How can i determine the file type?
I have to do these actions:
1. I have tor read all files from a directory and check them
2.after checking i have to read only the excel files.
I have tried with the code..
initial_dir = ["./upload_dir"]
for dir in initial_dir
Find.find(dir)do |path|
files_list << path
file_part= path.split('/')
file_type=file_part[1].split('.')
if(file_type[1]=='xls')
read the file
end
end
end
error is "Exception: Permission denied - ./upload_dir"
probably, the code also try to process the "../" and "./"
So how can i check the file type.
please help me waiting for ur response
Sasaki