I have to delete files specified by remove.txt which looks like this:
img_8138.dng.jpg
img_8140.dng.jpg
img_8141.dng.jpg
img_8143.dng.jpg
I've tried several suggestions from the web:
while read file; do rm "$file"; done < remove.txt
xargs -rd '\n' --arg-file=remove.txt rm -i --
rm $(cat /Volumes/space1/remove.txt)
xargs rm <remove.txt
etc
The files are in the current directory some of which are to be deleted (remove.txt). Deletion works if I use rm on the current directory. But using the list I get the error below every time.
rm: cannot remove ‘img_8147.dng.jpg’: No such file or directory
Any ideas what's going wrong?
while
loop) withdo echo rm "$file"; done
and then just copy/paste one of the printed commands into the shell?