bash - Find & delete folder (ubuntu server) -
i have backup system in ubuntu server every day makes database backup , save in folder named day: $(date +%d%m%y) on script, when try find , delete folders last week, command don't find directory.
im trying with: find -name $(date +%d%m%y) -type d -mtime +7 -exec rm -r {}; , never find directory. y tryed changing -mtime time 1 day or 2, dont find nothing.
i think made small mistake:
when backup on 7th of may, create folder name 070515. when search week later, folder name 140515 modified more 7 days ago. however, folder has been created today.
you may not need name of folder, use
find /backup/path -type d -mtime +7
to find folders older 7 days.
Comments
Post a Comment