Skip to content

Find and remove old files on linux

wordpress meta

title: 'Find and Remove Old Files on Linux'
date: '2012-11-06T01:23:32-06:00'
status: publish
permalink: /find-and-remove-old-files-on-linux
author: admin
excerpt: ''
type: post
id: 28
category:
    - Bash
    - Linux
tag: []
post_format: []

bash-3.00# find FOO/*bar* -mtime +30 -exec ls -lh {} \;
-rwxrwxrwx   1 143      staff        16G Jul 13 04:08 FOO/bar_backup_201207130403.bak
...snip
-rwxrwxrwx   1 143      staff        16G Sep 12 18:34 FOO/bar_backup_201209121827.bak

bash-3.00# find FOO/*bar* -mtime +30 -exec rm -f {} \;

bash-3.00# find FOO/*bar* -mtime +30 -exec ls -lh {} \;