Applies to FreeBSD and Linux.
/mnt
/backup1
/server1
/folder1
/folder2
/backup1.tar.gz
/server2
/server3
find /mnt/backup1 -maxdepth 2 -name '*.gz' -mtime +7 -exec rm {} \;
This will find and remove files that are 7 days old. It will search 2 folders deep from /mnt/backup1. It will not search folder1 or folder2. The single quotes around the name search string are required at least on FreeBSD.
/mnt
/backup1
/server1
/folder1
/folder2
/backup1.tar.gz
/server2
/server3
find /mnt/backup1 -maxdepth 2 -name '*.gz' -mtime +7 -exec rm {} \;
This will find and remove files that are 7 days old. It will search 2 folders deep from /mnt/backup1. It will not search folder1 or folder2. The single quotes around the name search string are required at least on FreeBSD.
Comments
Post a Comment