Page 1 of 1

list all in directory

Posted: Mon Jan 14, 2013 6:16 am
by dexter
I just want a function ,to list all file include subdirs of a directory

It seems something to do with local vars?


and I searched in forum, but forum says my key words are too common to search

so anyone can help me ?

Thanks

Re: list all in directory

Posted: Mon Jan 14, 2013 6:51 am
by HPW

Re: list all in directory

Posted: Mon Jan 14, 2013 7:04 am
by dexter
No ...
I think i's not

Re: list all in directory

Posted: Mon Jan 14, 2013 7:08 am
by dexter
as far as I can see the way is

(exec "find . -type -f")

I just want do it in newlisp way

Re: list all in directory

Posted: Mon Jan 14, 2013 7:48 am
by bairui
This is shown in CodePatterns under Walking A Directory Tree in section 5.

Re: list all in directory

Posted: Mon Jan 14, 2013 7:54 am
by cormullion

Re: list all in directory

Posted: Mon Jan 14, 2013 8:00 am
by dexter
Thanks guys

It's weired and failed , when I did not use (append) to do this iter

anyway thanks

Re: list all in directory

Posted: Mon Jan 14, 2013 8:06 am
by dexter
BTW

is there a function
replace a string in a string ,but never change the orginal string ?

newlisp's replace is just edit the orginal string

Re: list all in directory

Posted: Mon Jan 14, 2013 8:13 am
by bairui
Use the (copy ) function on the string.

Code: Select all

(replace "hello" (copy x) "goodbye")