I have text files listing a lot of files that are on my linux system that have been identified as needing to be deleted. Some of these files were created on Windows and contain '1. ' or '2. ' (i.e. with literal space after the period) etc. etc.
The rm
command deletes them if I enter rm -f
command with the file name in quotes. But entering this command 700,000 times in not going to happen.
I tried inputting the "list" files into the command but it skips the ones with the irregular name.
Is there anyway to put the delete commands into a script to perform it in an automatized way?
.
(as implied by your question title) but rather the embedded whitespace in the filenames that poses the problem. If so, please edit the question title to make this more prominent. Also, if you can give a few examples of what your list file looks like, it would make it easier for contributors to help you with your problem. – AdminBee Jan 15 '20 at 09:51-f
, and automation. Therefore it should be two questions (one question per question policy) – ctrl-alt-delor Jan 15 '20 at 10:041.
and2.
. @ctrl-alt-delor That might change the meaning of the question significantly. – AdminBee Jan 15 '20 at 10:11