linux C ¶ÁȡĿ¼Îļþ²¢Í³¼ÆÎļþÊý
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#define MAX 1024
int get_file_count(char *root)
{
DIR *dir;
struct dirent * ptr;
int total = 0;
char path[MAX];
dir = opendir(root); /* ´ò¿ªÄ¿Â¼*/
if(dir == NULL)
{
perror("fail to open dir");
exit(1);
}
errno = 0;
while((ptr = readdir(dir)) != NULL)
{
//˳Ðò¶Áȡÿһ¸öĿ¼Ï
//Ìø¹ý“..”ºÍ“.”Á½¸öĿ¼
if(strcmp(ptr->d_name,".") == 0 || strcmp(ptr->d_name,"..") == 0)
{
continue;
}
//printf("%s%s\n",root,ptr->d_name);
//Èç¹ûÊÇĿ¼£¬ÔòµÝ¹éµ÷Óà get_file_countº¯Êý
if(ptr->d_type == DT_DIR)
{
sprintf(path,"%s%s/",root,ptr->d_name);
//printf("%s\n",path);
total += get_file_count(path);
}
if(ptr->d_type == DT_REG)
{
total++;
printf("%s%s\n",root,ptr->d_name);
}
}
if(errno != 0)
{
printf("fail to read dir"); //ʧ°ÜÔòÊä³öÌáʾÐÅÏ¢
exit(1);
}
closedir(dir);
return total;
}
int main(int argc, char * argv[])
{
int total;
if(argc != 2)
{
printf("wrong usage\n");
exit(1);
}
total = get_file_count(argv[1]);
printf("%s ha %d files\n",argv[1],total);
return 0;
}
Ïà¹ØÎĵµ£º
ѹËõÃüÁ
*.Z compress ³Ìʽ壓縮µÄ檔°¸£»
*.bz2 bzip2 ³Ìʽ壓縮µÄ檔°¸£»
*.gz gzip ³Ìʽ壓縮µÄ檔°¸£»
*.tar tar ³Ìʽ´ò°üµÄ資ÁÏ£¬ ......
ÕâÊÇlinuxÖÐÒ»¸ö·Ç³£ÖØÒªÃüÁÇë´ó¼ÒÒ»¶¨ÒªÊìϤ¡£ËüµÄ¹¦ÄÜÊÇΪijһ¸öÎļþ»òĿ¼ÔÚÁíÍâÒ»¸öλÖý¨Á¢Ò»¸öͬ²½µÄÁ´½Ó£¬ÀàËÆWindowsϵij¬¼¶Á´½Ó¡£
Õâ¸öÃüÁî×î³£ÓõIJÎÊýÊÇ-s£¬¾ßÌåÓ÷¨ÊÇ£º
sudo ln -s Ô´Îļþ Ä¿±êÎļþ
µ±ÎÒÃÇÐèÒªÔÚ²»Í¬µÄĿ¼£¬Óõ½ÏàͬµÄÎļþʱ£¬ÎÒÃDz»ÐèÒªÔÚÿһ¸öÐèÒªµÄĿ¼Ï¶¼·ÅÒ»¸ö±ØÐëÏàͬµÄÎļþ£¬ ......
mount [-t vfstype] [-o options] device dir
¡¡¡¡ÆäÖУº
¡¡¡¡1.-t vfstype Ö¸¶¨ÎļþϵͳµÄÀàÐÍ£¬Í¨³£²»±ØÖ¸¶¨¡£mount »á×Ô¶¯Ñ¡ÔñÕýÈ·µÄÀàÐÍ¡£³£ÓÃÀàÐÍÓУº
¡¡¡¡¹âÅÌ»ò¹âÅ̾µÏñ£ºiso9660
¡¡¡¡DOS fat16Îļþϵͳ£ºmsdos
¡¡¡¡Windows 9x fat32Îļþϵͳ£ºvfat
¡¡¡¡Windows NT ntfsÎļþϵͳ£ºntfs
¡¡¡¡Mount WindowsÎļþ ......
#ifdef XP_UNIX
/*
* Set up the plugin function table that Netscape will use to
* call us. Netscape needs to know about our version and size
* and have a UniversalProcPointer for every function we
* implement.
*/
pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
......
ÕâÆªÎÄÕºܳ¤£¬×ªÔØÏÂÀ´¹©×Ô¼ºÂýÂýѧϰ¡£
±à³ÌÐÞÑø £¨×÷Õߣº³Â𩣩
————
ʲôÊǺõijÌÐòÔ±£¿ÊDz»ÊǶ®µÃºÜ¶à¼¼Êõϸ½Ú£¿»¹ÊǶ®µ×²ã±à³Ì£¿»¹ÊDZà³ÌËٶȱȽϿ죿
ÎÒ¾õµÃ¶¼²»ÊÇ¡£¶ÔÓÚһЩ¼¼Êõϸ½ÚÀ´ËµºÍµ×²ãµÄ¼¼Êõ£¬Ö»Òª¿´°ïÖú£¬²é×ÊÁϾÍÄÜÕÒµ½£¬¶Ô
ÓÚËٶȿ죬ֻҪ±àµÃ¶àÒ²¾ÍÊìÄÜÉúÇÉÁË¡ ......