Project

General

Profile

Useful filename » History » Version 1

iri, 12/17/2011 10:47 PM

1 1 iri
h1. Useful filename functions
2
3
* Return a list with all files and sub-folders (recursively) from a given folder
4
_listcat_ is a function defined in "locked/lib/_mlistlib.pkg". This package must be loaded before use this snippet.
5
At the beginning, the second argument, _out_, should be at nil.
6
7
<pre>
8
fun getFilesInFolder (rep, out)=
9
	if rep == nil then
10
		out
11
	else
12
		let _listofsubdir hd rep -> reps in
13
		let _listoffiles hd rep -> files in
14
		(
15
		if reps != nil then set out = listcat getFilesInFolder reps nil out else nil;
16
		set out = listcat files out;
17
		getFilesInFolder tl rep out
18
		);;
19
</pre>
20
21
Author : iri
22
Date   : december 2011
23
24
*Return to [[Examples]]*