Hello.
If you are looking for a command similar to "tree" in DOS/Windows: I do not know if there is an equivalent but I wrote a program to do this myself. The output is not very good yet.
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
void printtree(char *dname,int lvl,dev_t dev)
{
struct stat st;
struct dirent *dnt;
static char buf[500];
DIR *d;
int i,l,m;
l=strlen(dname);
if(!dev)
{
stat(dname,&st);
dev=st.st_dev;
}
d=opendir(dname);
if(!d) return;
dname[ l ]='/';
while((dnt=readdir(d))!=NULL)
if(strcmp(dnt->d_name,".") && strcmp(dnt->d_name,".."))
{
m=0;
strcpy(dname+l+1,dnt->d_name);
lstat(dname,&st);
if(S_ISLNK(st.st_mode))
{
stat(dname,&st);
if(S_ISDIR(st.st_mode)) m=1;
}
else if(S_ISDIR(st.st_mode)) m=2;
if(m)
{
for(i=0;i<lvl;i++) printf("|");
printf("+ %s",dnt->d_name);
if(m==1)
{
i=readlink(dname,buf,sizeof(buf)-1);
if(i<0) printf(" <unknown symlink>");
else
{
buf[ i ]=0;
printf(" <symlink to %s>\n",buf);
}
}
else if(st.st_dev!=dev)
printf(" <mount point>\n");
else
{
printf("\n");
printtree(dname,lvl+1,dev);
}
}
}
closedir(d);
dname[ l ]=0;
}
main(int argc,char **argv)
{
static char a[500];
strcpy(a,(argc>1)?(argv[1]):".");
printtree(a,0,0);
return 0;
}
I hope this helps.
Martin