-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind_csvs_in_dir.sci
44 lines (25 loc) · 1.15 KB
/
find_csvs_in_dir.sci
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
ModuleName="find_csvs_in_dir";
Version="0.01";
DateModified="11-Jan-2016";
DateOfCreation="11-Jan-2016";
Author="Rob Eccleston";
Description="Lists all csvs in current directory and returns them as a list";
mprintf("Loading " + ModuleName + " V" + Version + ", Last Modified: " + DateModified + "\n");
function [csv_list]=find_csvs_in_dir(working_dir)
mprintf("Loading " + ModuleName + " V" + Version + ", Last Modified: " + DateModified + "\n");
//working_dir="C:\Users\re\Dropbox\Cologne University\Teagasc Secondment\gas_volume\" //with end slash
directory_contents=listfiles(working_dir)
num_files=size(directory_contents,1)
csv_list=""
j=1
for i=1:num_files
this_full_name=working_dir + directory_contents(i)
this_extension = fileext(this_full_name)
this_extension = convstr(this_extension, "l") //convert to lowercase
if this_extension== ".csv"
disp(this_full_name)
csv_list(j)=this_full_name
j=j+1
end
end
endfunction