linux recursively delete directory files

find . -name ".svn" | xargs -exec rm -rf

find . -name ".svn" | xargs rm -rf

find  .  -name  '*.svn'  -type  d  -print  -exec  rm  -rf  {} \;

 

(1) "." means to search recursively from the current directory

(2) "-name '*.svn' "Search by name, to find all folders or files ending with .svn

(3) "-type d" finds the type of directory

(4) "-print" outputs the searched file directory name

(5) The most important thing is -exec. The -exec option is followed by a command to be executed, which means that the found file or directory will be executed.

     The exec option is followed by the command or script to be executed, followed by a pair of {}, a space and a \, and finally a semicolon

 

Reference: http://www.centrue.me/2011/09/01/linux-xargs-find/

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326571112&siteId=291194637