Your check for . and .. is using the full path, so it will never match. There's your recursion.
In reply to Re: recursive path function falls into infinite loop
by steves
in thread recursive path function falls into infinite loop
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |