I have listed the names of the files which are to be deleted into a file. How can I pass the file to rm
command so that it should delete them one by one.
If you have one file per line, one way to do it is:
tr '\n' '\0' < list_of_files_to_be_deleted.txt | xargs -0 -r rm --
The file list is given as input to the tr
command which changes the file separator from linefeed to the null byte and the xargs
command reads files separated by null bytes on input and launches the rm command with the files appended as arguments.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments