linux - delete all files within a directory that are older than 1 day -


this question has answer here:

i need ensure have no old files left in directory think is

find . -type f -mtime +1 -delete 
  • i got find man page

    find . -type f -mtime +1 -exec /bin/rm

but again, told find: -exec requires argument - didn't ii pass this. started googling , found command needs likee this:

find . -type f -mtime +1 -exec /bin/rm -f {} + 

and i'm wondering 2 {} s , + sign for. can me here?

thanks!

the {} stands name of file(s) found.

the + sign (instead of ;) means command accepts multiple file names in same command, find can run faster because run less times. number of files added each execution of command limited maximum length of command line find willing use.


Comments