Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

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


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

The quotes protect filenames with spaces.

share|improve this answer

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 {} \;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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