4 Replies Latest reply: May 15, 2014 10:09 AM by Bill Watson RSS

    File Creation Date

    mdyoung _

      Is there a way to pull in to Monarch Pro (v10.5) the date that the input file was created? I need this date in a calculated field or something.

       

      Thanks,

       

      Micheal

        • File Creation Date
          Data Kruncher

          If you mean the DOS/Windows file creation date of the report file, then no, Monarch doesn't have a facility to report that.

           

          I'm sure that you could build it with some VBA/VBS coding though, and send the date value to the model using a runtime parameter, which could then be used in other calculated fields.

           

          While unusual, I suspect that it wouldn't be too difficult as programming tasks go (says the fellow who's not done it yet ).

            • File Creation Date
              Olly Bond

              Hello Michael,

               

              I think there's a way to do this avoiding programming.

               

              dir > listing.prn[/code]

               

              generates the list of files in a folder as a text file called listing.prn.

               

              It's very easy in Monarch to extract the folder, filename, filesize and date and export these to a table.

               

              Then your main model can do an external lookup to this. If you want to match on the filename, then:

               

              rsplit(File();2;"\";1)[/code]

               

              should work as a field to link on.

               

              The whole thing can be easily programmed in a batch file.

               

              HTH,

               

              Olly

                • File Creation Date
                  Data Kruncher

                  Hello Michael,

                   

                  I think there's a way to do this avoiding programming.

                   

                   

                   

                  The whole thing can be easily programmed in a batch file.

                   

                  HTH,

                   

                  Olly[/quote]

                   

                  Make up my mind! Don't program, or program? ;):D;)

                   

                  So long as you're preparing a batch file, may as well whip up a VBS script.

                   

                  Dim filesys, demofile, createdate

                  Set filesys = CreateObject("Scripting.FileSystemObject")

                  Set demofile = filesys.GetFile("C:\folder\RptFile.txt")

                  createdate = demofile.DateCreated

                   

                  'now setup a monarch object and set RunTimeDate = createdate

                  'and then open the model and report or project

                  'RunTimeDate should be Character, I suspect,

                  'and then use CtoD(RunTimeDate,"m/d/y") to get a real date

                  /codeThere are examples around here somewhere of running Monarch via VBS.

                   

                  Edit: Credit for the VBS code to http://www.devguru.com/technologies/vbscript/quickref/file.html[/URL]

                    • File Creation Date
                      Bill Watson

                      I know this is a monarch question, but if you were doing similar in datapump you could add the following to a preprocess script to retrieve the file created date. You could then set a run time parameter in the model with the date.

                       

                      You need to add System.IO to the Imports

                       

                      Then in your script section just add the following

                      Dim oFI As New FileInfo("C:\folder\RptFile.txt")

                       

                      'To get the creation, lastaccess, lastwrite time of this file

                      Dim dtCreation As DateTime = oFI.CreationTime

                      Dim dtAccess As DateTime = oFI.LastAccessTime

                      Dim dtWrite As DateTime = oFI.LastWriteTime

                      /code