Shell command/script to delete files whose names are in a text file

后端 未结 6 1973
醉酒成梦
醉酒成梦 2020-12-24 04:00

I have a list of files in a .txt file (say list.txt). I want to delete the files in that list. I haven\'t done scripting before. Could some give the shell script/command I c

6条回答
  •  情话喂你
    2020-12-24 04:15

    The following should work and leaves you room to do other things as you loop through.

    Edit: Don't do this, see here: http://porkmail.org/era/unix/award.html

    for file in $(cat list.txt); do rm $file; done

提交回复
热议问题