I have a file full of filepaths relative to its own path:

./Talent/152/Resume/a file name.pdf
./Talent/153/Resume/some file name.pdf
./Talent/154/Resume/yet another file name.pdf
... and so on ...

What would be the appropriate shell command to go through each line in this file and remove it?

link|improve this question
feedback

3 Answers

up vote 5 down vote accepted
xargs -d '\n' rm < listoffiles.txt
link|improve this answer
+1 very handy to know... i was unaware of the -d option for xargs... – cpbills Jun 6 '10 at 0:53
feedback
xargs -I{} --arg-file=file rm "{}"

or

xargs -I{} -a file rm "{}"

The quotes protect filenames with spaces.

link|improve this answer
feedback

If you are in a Bash shell you can do :

find ./Talent/*/Resume/* -exec rm {} \;

or if you want to delete the files older than 7 day you can add -mtime param like this :

find ./Talent/*/Resume/* -mtime +7 -exec rm {} \;
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.