remove all of a file type from a directory and its children

后端 未结 6 1702
南笙
南笙 2021-02-01 15:36

I was under impression that

rm -r *.xml

would remove all file from parent and child however:

*.xml: No such file or directory
         


        
6条回答
  •  后悔当初
    2021-02-01 16:13

    ZSH recursive globbing to the rescue!

    Invoke zsh: zsh

    Be sure you're in the dir you intend to be in: cd wherever

    List first: ls **/*.xml

    Remove: rm **/*.xml

    I'll resist the strong temptation to bash on bash, and just point to the relevant zsh docs on the topic here.

提交回复
热议问题