Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Date
Message
 
 
À
25/03/2003 14:30:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Date
Divers
Thread ID:
00769876
Message ID:
00772566
Vues:
6
>Ok i want to compare two different date
>the first date is like this
>
>Tue, 28 Jan 2003 15:04:04
>
>How ca i do

Below is a compare routine to delete files after copying them to a new directory if they have a created-date older then specified.
PROCEDURE EntireDirect
   SCAN
      gLogMESS= PADL(ALLTRIM(IIF(lSubDir,STR(RECNO()),"*")),8," ")+ ;
                PADL(ALLTRIM(STR(RECNO())),7," ")+ " "+ ;
                PADR(cDirts+ FileName,50," ")+ DTOC(DateCreated)+ ;
                IIF(VAL(SYS(11,DATE()))- VAL(SYS(11,DateCreated))> lnDay," DELETED"," KEPT")
      IF !lDeleteThem
         gLogMess= gLogMess+ " TEST. No delete!" 
      ELSE
         IF VAL(SYS(11,DATE()))- VAL(SYS(11,DateCreated))> lnDay
            IF cDirty <> " "
               cDirectorySub= IIF(lSubDir, SUBSTR(cDirts,AT("\",cDirts,OCCURS("\",cDirts)-1)+1), "")
               IF !DIRECTORY(cDirty+ cDirectorySub)
                  sDirtyDirSub= cDirty+ cDirectorySub
                  MD &sDirtyDirSub
               ENDIF 
               IF !FILE(cDirty+ cDirectorySub+ ALLTRIM(FileName))
                  cmd2copy= "COPY FILE "+ cDirts+ ALLTRIM(FileName)+ " TO "+ cDirty+ cDirectorySub+ "*.*"
                  &cmd2copy
               ENDIF 
            ENDIF
            IF FILE(cDirty+ cDirectorySub+ ALLTRIM(FileName))
               DELETE FILE cDirts+ ALLTRIM(FileName)
               nDeleted= nDeleted+ 1
            ELSE 
               IF !EMPTY(cDirty)
                  gLogMess= " No Delete! Copy to New area failed. "+ ALLTRIM(FileName)
               ENDIF
            ENDIF
         ENDIF
      ENDIF 
      Do WriteLog
   ENDSCAN 
The table (cursor) being scanned is formatted like an ADIR().
The Sub-Directory at destination may not exist and therefore created before the file is copied to it from origin. The origin file is only removed after verification of file-to-destiny. The date of the Created file is examined - see SYS(11) for more detail.
Edgar L. Bolton, B.S. B.B.A.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform