我有一个完整的文件path相对于自己的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 ...
通过这个文件中的每一行并删除它的适当的shell命令是什么?
xargs -d '\n' rm < listoffiles.txt
xargs -I{} --arg-file=file rm "{}"
要么
xargs -I{} -a file rm "{}"
引号用空格保护文件名。
如果你在一个Bash shell中,你可以这样做:
find ./Talent/*/Resume/* -exec rm {} \;
或者如果你想删除超过7天的文件,你可以像这样添加-mtime参数:
find ./Talent/*/Resume/* -mtime +7 -exec rm {} \;