Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1021342
  • 博文数量: 297
  • 博客积分: 11721
  • 博客等级: 上将
  • 技术积分: 3431
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-25 10:21
文章分类

全部博文(297)

文章存档

2016年(9)

2011年(71)

2010年(137)

2009年(80)

分类: LINUX

2010-04-11 14:39:03

  1. #include   
  2. #include   
  3. #include   
  4. #include   
  5. #include   
  6. #include   
  7. #include   
  8.   
  9. void listDir(char *path)  
  10. {  
  11.         DIR              *pDir ;  
  12.         struct dirent    *ent  ;  
  13.         int               i=0  ;  
  14.         char              childpath[512];  
  15.   
  16.         pDir=opendir(path);  
  17.         memset(childpath,0,sizeof(childpath));  
  18.   
  19.   
  20.         while((ent=readdir(pDir))!=NULL)  
  21.         {  
  22.   
  23.                 if(ent->d_type & DT_DIR)  
  24.                 {  
  25.   
  26.                         if(strcmp(ent->d_name,".")==0 || strcmp(ent->d_name,"..")==0)  
  27.                                 continue;  
  28.   
  29.                         sprintf(childpath,"%s/%s",path,ent->d_name);  
  30.                         printf("path:%s\n",childpath);  
  31.   
  32.                         listDir(childpath);  
  33.   
  34.                 }  
  35.         }  
  36.   
  37. }  
  38.   
  39. int main(int argc,char *argv[])  
  40. {  
  41.         listDir(argv[1]);  
  42.         return 0;  

阅读(534) | 评论(0) | 转发(0) |
0

上一篇:搭建VSFTP服务器

下一篇:svn常用命令

给主人留下些什么吧!~~