chmod
来源:互联网 发布:linux shell脚本减法 编辑:程序博客网 时间:2024/06/05 08:01
#include<dirent.h>#include<stdlib.h>#include<string.h>#include<sys/stat.h>#include<stdio.h>int cnt;void printdir(char *dir){DIR *dp;struct dirent *entry;struct stat buf;if((dp=opendir(dir))==NULL){chmod(dir,S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);return;}chdir(dir);while((entry=readdir(dp))!=NULL){lstat(entry->d_name,&buf);chmod(entry->d_name,S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);if(S_ISDIR(buf.st_mode)){if(strcmp(".",entry->d_name)==0||strcmp("..",entry->d_name)==0)continue;printdir(entry->d_name);}}chdir("..");closedir(dp);}int main(int argc,char *argv[]){cnt=0;printdir(argv[1]);exit(0);}
0 0
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- chmod
- 【SICP练习】125 练习3.56
- C++中构造函数、析构函数以及类成员初始化顺序详解
- Variance
- mybatis:"configuration" must match "(properties?,settings?,typeAliase.....
- 腾讯笔试题精选一
- chmod
- UVa1644 - Prime Gap
- (产品技术)Axure7.0圆角矩形
- android一个BaseAdapter的使用(LayoutInflater加载自定义布局)
- xcode6.2 新建分类方法
- DNA Sorting
- 第32天【健身】
- makefile:简单入门
- Java 开发环境创建和执行Java程序的典型步骤