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;
}
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
linuxÔ¶³Ì¸´ÖÆ linuxÔ¶³Ì¿½±´
Ô¶³ÌÉÏ´«Îļþ¼Ð
¾ÙÀý£¬
ÎÒÒª½«±¾µØÎļþ¼Ð/home/administrator/Desktop/old/driver/test/
Ô¶³ÌÉÏ´«µ½ 192.168.62.10 Õą̂»úÆ÷µÄ/root/Îļþ¼ÐÏ£¬Ê¹ÓÃÔ¶³Ì¶ËµÄrootÓû§×÷ΪµÇ½Óû§
scp -r /home/administrator/Desktop/old/driver/test/ root@192.168.62.10:/root/
Ô¶³ÌÉÏ´«Îļþ¼Ð
¾ÙÀ ......
ÕâÊÇ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Îļþ ......
linuxÄÚºËinit½ø³Ìº¯ÊýµÄ²¿·Ö´úÂëÈçÏ£º 01 if (execute_command)
02 run_init_process(execute_command);
03
04 run_init_process("/sbin/init");
05 run_init_process("/etc/init");
06 run_init_process("/bin/init");
07 run_init_process("/ ......