4

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?

3 Answers 3

5
xargs -d '\n' rm < listoffiles.txt
1
  • +1 very handy to know... i was unaware of the -d option for xargs...
    – cpbills
    Jun 6, 2010 at 0:53
1
xargs -I{} --arg-file=file rm "{}"

or

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

The quotes protect filenames with spaces.

1

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 {} \;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .