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 can use. I have bash shell.
相关问题
- How to get the return code of a shell script in lu
- What is the best way to do a search in a large fil
- Spring Integration - Inbound file endpoint. How to
- Invoking Mirth Connect CLI with Powershell script
- Emacs shell: save commit message
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- In IntelliJ IDEA, how can I create a key binding t
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- What is the correct way to declare and use a FILE
- Is there a non-java, cross platform way to launch
- Making new files automatically executable?
- Launch interactive SSH bash session from PHP
For fast execution on macOS, where
xargs
custom delimiterd
is not possible:Try this command:
If the file names have spaces in them, none of the other answers will work; they'll treat each word as a separate file name. Assuming the list of files is in
list.txt
, this will always work:is slow.
will fail if there are too many arguments.
I think it should work:
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