Linux/SSH command to delete every filepath found in file
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?
xargs -d '\n' rm < listoffiles.txt
xargs -I{} --arg-file=file rm "{}"
or
xargs -I{} -a file rm "{}"
The quotes protect filenames with spaces.
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 {} \;