Neue Verzeichnisse finden
Florian Lohoff
flo at rfc822.org
Mon Jan 26 16:12:24 CET 2004
On Mon, Jan 26, 2004 at 03:59:32PM +0100, Ralph Meyer wrote:
> Hallo Liste,
>
> ich möchte einmal pro Tag per cronjob in einem Verzeichnis
> nach neuen Verzeichnissen suchen. Falls eins oder
> mehrere neue vorhanden sind, möchte ich nacheinander in
> die neuen Verzeichnisse wechseln und dort ein
> Script ausführen. Hat jemand eine Idee wie man sowas
> lösen könnte?
Je nachdem wie wichtig das ist das die scripte nur einmal laufen koennte
man das so machen
find /path -type d -ctime -24 -exec /path/to/script {} \;
Das fuehrt das script aus wenn das directory weniger als 24 stunden als
ist - Vorrausgesetzt das dein script alle 24 Stunden laeuft.
Wenn es wichtiger ist:
find /path -type d | while read dir; do
if [ ! -f ${dir}/.processed ]; then
/path/to/script
touch ${dir}/.processed
fi
done
Dann liegt ein file drin wenns prozessiert ist.
Flo
--
Florian Lohoff flo at rfc822.org +49-171-2280134
Heisenberg may have been here.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lug-owl.de/pipermail/linux/attachments/20040126/c5f34ad7/attachment.sig>
More information about the Linux
mailing list