shell script to get the arrival count of file

Hello All,

I have come across a small problem. It would be great if any of you could help me in resolving the issue.

one file named dummy.txt will be ftped to Unix machine twice daily. If i receive it second time in a day i need to do some processing with the file.

How to find the number of times it arrived to Unix box?

Please help me by giving some ideas?

Thanks

What do you mean?
If ftped twice a day, sure you will receive it a second time... or that is not what you ment...
Should we understand the file can be resent later independently of the 2 daily occurences?

Ad hoc (assumed you'll remove the processed file),

  • you may want to create and schedule (cron) a script, which
  • on a regular base checks for the file in question ('if -f file'),
  • stores it's details ('ls -l file') to a status file ('> status_one'),
  • if status_one exists, compares the current file's details to those stored,
  • if different, processes the current file and finally removes the status file.