[Gllug] bash script to find, list and save log

Liam Delahunty ldelahunty at britstream.com
Wed Aug 20 09:39:17 UTC 2003


Hi,

I have the following find command to get all the mail spool files that have
been updated in the last day. [1]

find /home/spool/mail -mtime -1 \! -type d -exec ls -lh '{}' ';' -print |
sort >> /tmp/spool.mail.daily.log

which produces results such as:

line1: -rw-------    1 user1 home         1.9M Aug 20 08:40
/home/spool/mail/user1
line2: -rw-------    1 user2 home            0 Aug 20 10:13
/home/spool/mail/user2
line3: /home/spool/mail/user1
line4: /home/spool/mail/user2


I don't want the extra /home/spool/mail/userx lines 3 and 4...

Could some kind soul tell me what I've done wrong in my command?

[1] It's part of a larger script that also gets the not empty files and tar
zips the lot for off server backup. This is just my daily log, and is
beginning to annoy the pants off of me!

warm regards,
Liam


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list