Hello Fred, Fred Zinsli <fred.zin...@shooter.co.nz> wrote: > I am attempting to create a script (#!/bin/sh) that searches for files > created on the first day of the week, then on the first day of the month, > then the first day of the year. as seperate events. All the files are in > one directory so easy to find, though the files could have any name. And I > already know how to take the action I want once found. I just can't seem > to work out how to find the files in question.
Did you try find’s -ctime option together with date? For example: find . -ctime $(($(date +%w)-1)) (translating to find . -ctime 1 at the moment) will find files last changed 1 day ago. Similar options for months and years exist. However, there is some rounding involved that might make things more difficult. You should also take into account that this way will only find files based on their ctime, which is updated on every write (I think, please check before relying on this). Best regards, Claudius -- Mistrust first impulses; they are always right. http://chubig.net telnet nightfall.org 4242
signature.asc
Description: PGP signature