Command line: piping find results to rm

前端 未结 4 1205
时光取名叫无心
时光取名叫无心 2020-12-07 07:19

I\'m trying to work out a command which deletes sql files older than 15 days.

The find part is working but not the rm.

rm -f | find -L /usr/www2/bar/         


        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 08:09

    Another simpler method is to use locate command. Then, pipe the result to xargs.

    For example,

    locate file | xargs rm
    

提交回复
热议问题