find

man: NAME: find – find files

Find/Remove old files

Find files modified more then 365 days ago;

find . -mtime +365 -exec ls -l {} \;

Use touch to test

$ touch -t 197801130300 oldfile
$ find . -mtime +365 -exec rm {} \;
$ ls oldfile
ls: oldfile: No such file or directory

2 thoughts on “find

  1. Ben says:

    If you have a couple of configuration files you need to edit to change a parameter. And you want to make sure you get them all.
    Then find is also very handy combined with xargs

    vi `find . -type f |xargs grep -l `

  2. remivisser says:

    Ben, you have got to be kidding me!!! Where are you these days.

    Mijn grote voorbeeld leeft dus toch nog? !!

    Ik heb uw voorbeeld gevold, hebt het juk van CMG afgeschud en ben gaan contracten. Bevalt uitsteekbaar, ik mail u!

    remi@

Leave a Reply

Helpful? - leave your note below so I can brag

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>