Unix: How to delete files listed in a file

后端 未结 13 1553
遥遥无期
遥遥无期 2020-12-04 06:31

I have a long text file with list of file masks I want to delete

Example:

/tmp/aaa.jpg
/var/www1/*
/var/www/qwerty.php

I need delet

13条回答
  •  有刺的猬
    2020-12-04 07:08

    xargs -I{} sh -c 'rm {}' < 1.txt should do what you want. Be careful with this command as one incorrect entry in that file could cause a lot of trouble.

    This answer was edited after @tdavies pointed out that the original did not do shell expansion.

提交回复
热议问题