linuxÔõô½¨ÉèĿ¼
ÔÚ linux ϵͳÖУ¬¿ÉÒÔʹÓÃÒÔÏÂ5ÖÖÒªÁ콨ÉèĿ¼£ºmkdir ÏÂÁîmkdir -p Ñ¡ÏîʹÓÃÊ÷Ðνṹxargs ÏÂÁîfind ÏÂÁî
ÔõÑùʹÓà Linux ½¨ÉèĿ¼
ÔÚ Linux ϵͳÖУ¬½¨ÉèĿ¼ÊÇÒ»¸ö³£¼ûµÄ²Ù×÷£¬¿ÉÒÔͨ¹ýÒÔÏÂÒªÁìʵÏÖ£º
1. ʹÓà mkdir ÏÂÁî
mkdir ÏÂÁîÊÇ×î³£ÓõĽ¨ÉèĿ¼ÏÂÁî¡£ÆäÓï·¨ÈçÏ£º
mkdir [Ñ¡Ïî] Ŀ¼Ãû
µÇ¼ºó¸´ÖÆ
ÀýÈ磬Ҫ½¨ÉèÃûΪ “my_directory” µÄĿ¼£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
mkdir my_directory
µÇ¼ºó¸´ÖÆ
2. ʹÓà -p Ñ¡Ïî
-p Ñ¡Ïî¿ÉÒÔ½¨Éè²»±£´æµÄ¸¸Ä¿Â¼¡£ÀýÈ磬Ҫ½¨ÉèÃûΪ “my_directory/sub_directory” µÄĿ¼£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
mkdir -p my_directory/sub_directory
µÇ¼ºó¸´ÖÆ
3. ʹÓÃÊ÷Ðνṹ
ÒªÒ»´ÎÐÔ½¨Éè¶à¸öĿ¼²ã¼¶£¬¿ÉÒÔʹÓÃÊ÷Ðνṹ¡£ÀýÈ磬Ҫ½¨ÉèÃû³ÆΪ “my_directory/sub_directory/sub_sub_directory” µÄĿ¼½á¹¹£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
mkdir -p my_directory/{sub_directory,sub_sub_directory}
µÇ¼ºó¸´ÖÆ
4. ʹÓà xargs ÏÂÁî
xargs ÏÂÁî¿ÉÒÔ½«Ò»ÏµÁÐÃû³ÆÓÃ×÷ÁíÒ»¸öÏÂÁîµÄ²ÎÊý¡£ÀýÈ磬Ҫ½¨ÉèÒ»×éÃûΪ “directory1″¡¢”directory2” ºÍ “directory3” µÄĿ¼£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
echo directory1 directory2 directory3 | xargs mkdir
µÇ¼ºó¸´ÖÆ
5. ʹÓà find ÏÂÁî
find ÏÂÁî¿ÉÒÔËÑË÷ºÍ½¨Éè²»±£´æµÄĿ¼¡£ÀýÈ磬Ҫ½¨ÉèÃûΪ “my_directory” µÄĿ¼£¬ÈôÊǸÃĿ¼²»±£´æ£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
find . -type d -name my_directory -o -exec mkdir my_directory \;
µÇ¼ºó¸´ÖÆ
×¢ÖØ£º
½¨ÉèĿ¼ÐèÒª¶ÔÄ¿µÄĿ¼µÄ¸¸Ä¿Â¼¾ßÓÐдȨÏÞ¡£
Ŀ¼Ãû²»¿É°üÀ¨ÌØÊâ×Ö·û£¬Èç “/”£¨Ð±¸Ü£©¡£
ʹÓà -v Ñ¡Ïî¿ÉÒÔÏÔʾ½¨ÉèĿ¼µÄÏêϸÀú³Ì¡£
ÒÔÉϾÍÊÇlinuxÔõô½¨ÉèĿ¼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡