ãã¼ã¿ããªããã©ã«ããæ¶ãããã«ç©ºã«ãã£ã¬ã¯ããªãåæãããã使ãã¨æã£ã¦ä½ã£ããã£ã¬ã¯ããªã ã£ããããã¡ã¤ã«ãåããã¦ç©ºã®ãã£ã¬ã¯ããªãã¾ã¨ãã¦æ¶ããã
空ã®ãã£ã¬ã¯ããªä½æ¥ã®éªéã ããæ¶ããã
find ã§ç©ºãã£ã¬ã¯ããªãåæãã¦ãxargs ã§æ¶ã*1
空ã®ãã£ã¬ã¯ããªãåæããã«ã¯
find -type d -empty
æ¶ãã«ã¯Xargsã¨çµã¿åãã
xargsã¨çµã¿åããã
find -type d -empty | xargs -I@ rm -rf @
-emptyãªãã·ã§ã³ã¨ -type ãªãã·ã§ã³ã¯
man find ã«ããã¨
-empty File is empty and is either a regular file or a directory. -type c File is of type c: d directory f regular file
ã¨ããã㨠type -f 㧠ãã¡ã¤ã«åæ type -d ã§ãã£ã¬ã¯ããªåæ
xargs好ã
- execãªãã·ã§ã³ä½¿ã£ã¦ãè¯ãããã©ãç¨éå¥ã« åãã¦ã³ããã§ããã®ã§Xargsã使ã£ã¦ã¾ãã
*1:find ã®-execã§ããããã©