Skip to main content
3 of 4
deleted 1 character in body
Mike
  • 65
  • 1
  • 9

Interactive remove files listed with paths in text file

I am trying to interactively remove files listed with their paths in a text file.

The command I am trying is: xargs rm -i <filelist.txt

The error I get is:

rm cannot remove 'directory1/directory2/filename.extension\r': No such file or directory.

I suspect the \r that has been added to the end of the filename is an indication of what is wrong, but I have no idea what it might mean.

I also tried: xargs -rd '\n' --arg-file=filelist.txt rm -i --

with the exact same result.

Files are listed in filelist.txt in the format: directory1/directory2/filename.extension

where directory1 is in the current directory.

Mike
  • 65
  • 1
  • 9