I use the following command in order to delete only the files that start with DBG
and older then two day , but this syntax not print the files that deleted
find /tmp -type f -mtime +2 -name "DBG*" -exec rm {} \;
How to add to this the find syntax , the print in order to print the deleted files?
Best Answer
Just use
-print
flag:or, if
rm
supports the-v
option, letrm
do it all:or if your
find
supports-delete
:(note that the first two have a race condition that could allow one to delete
DBG*
files anywhere on the file system)