How to delete multiple files at once in Bash on Linux?

前端 未结 7 744
有刺的猬
有刺的猬 2021-01-29 19:09

I have this list of files on a Linux server:

abc.log.2012-03-14
abc.log.2012-03-27
abc.log.2012-03-28
abc.log.2012-03-29
abc.log.2012-03-30
abc.log.2012-04-02
ab         


        
7条回答
  •  野性不改
    2021-01-29 19:36

    A wild card would work nicely for this, although to be safe it would be best to make the use of the wild card as minimal as possible, so something along the lines of this:

    rm -rf abc.log.2012-*
    

    Although from the looks of it, are those just single files? The recursive option should not be necessary if none of those items are directories, so best to not use that, just for safety.

提交回复
热议问题