The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 11-14-2006
Sree_2503 Sree_2503 is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 10
Hi,

Thanks RTM. This seems to be the best solution so far. I have designed the flow of the algorithm based on this solution - here it goes -

Code:
--*******************************************--
| Non-Repeating Mailing Logic in the program: |
--*******************************************--

---------------------------------------------------------
|BEGIN PROCESSING BLOCK:				|
---------------------------------------------------------


Check for existence of File A_Old created on the previous day.
 
 If File A_Old was created on the previous day, then
 
    Remove File A_Old.
 
 Else, 

1. Create File A.

If File A > 0 bytes, then

   2. Check whether File A_Old exists or not.
   
   If File A_Old does not exist, then     -- (this implies this is the first time mailing process)
   
   2a(i). Copy File A to File A_Old.
   2a(ii). Mail File A to the users.
   2a(iii). Remove File A.
   
   If File A_Old does exist, then      -- (this implies we might have already mailed the Rejects file)
   
   2b. Compare File A with File A_Old.
   
       If both the files are the same, then
       
       2b(i). Skip Mailing process.
       
       If the files are different, then
       
       2b(ii). Copy File A to File A_Old.
       2b(iii).Mail File A.
       2b(iv). Remove File A.

If File A = 0 bytes, then

   Skip entire mailing process.
   
---------------------------------------------------------
|END PROCESSING BLOCK:					|
---------------------------------------------------------
However, for this to go right, I need to know how can I find whether a file is created on the previous day or not(i.e in any way can the file creation timestamp be retrieved and comapared against the current date), if the timestamp is of the last day, then I would be deleting the old file, otherwise retain it.

Thanks again, RTM .

-
Sree