How to monitor a unix folder?

:confused:Hi All,
I have a folder on Sun Solaris 5.8 SPAC and I'm trying to build a monitoring shell or perl script that sends an email to a user whenever a file was put into this folder.
issue:
if I create a new file in the folder using like 'touch newfile', then the newfile has a current unix system timestamp on it, but if I drag a file from a windows xp to this unix folder, the timestamp of the file wouldn't change, it still keeps the created time when I created it on win xp, so it's impossible to monitor the folder by checking all files timestamp.

How can I work around this issue?
any ideas are appreciated.

Thanks,
Bizheng

Have you tried looking at ctime instead of mtime?

If this is linux: man fcntl and look at the F_NOTIFY interface.

The original post stated that this was Solaris 8.

it seems to use ctime can fix this problem, no matter the file was created by unix user or was dragged from windows xp, ctime always shows the time when it was created in UNIX, but 'ls -l' only shows modification time, if the file's from windows then ctime , mtime are different.

Thanks all for your replies, really appreciated!

Hi.

Use caution in interpreting the "c" in ctime:

Best wishes ... cheers, drl

Hi.

I think I'd look at the mtime of the directory in which the files are being placed.

I'm somewhat surprised that Sun doesn't have anything to address this kind of situation. I looked briefly through Sun Microsystems - BigAdmin System Administration Portal and saw nothing on point ... cheers, drl

:b:cool , thanks a lot!

you don't have to reinvent the wheel. Here's one tool you can use, if you are allowed to install it on your system.

Apologies. Didn't look closely enough at the OP.