handle directory tree