1 Reply Latest reply: Jun 9, 2017 6:55 AM by Mo Abdolrahim RSS

    Getting the input file name in a PreProcess script

    Simon Knowd

      I am currently trying to create  Datapump PreProcess and PostProcess scripts that in the preprocess script will copy a file to a destination file with the same filename as the input file name ie. input file is abcd1234.txt and I want to copy default.csv to \\<destination server>\<destination folder>\abcd1234.csv    and then in the PostProcess script can then rename the csv to a different extension say "abc" for example

       

      The catch here is the Data Pump script is monitoring the source folder \\<source server>\<source folder>\ for any text - ".txt" - files that are put into the folder, so I don't actually know the name of the input file

       

      How do I find out the name of the input file that the monitoring has detected so that I can use it in my PreProcess script, and ultimately pass it into a post processing script

        • Re: Getting the input file name in a PreProcess script
          Mo Abdolrahim

          If there is only one input file, you can use the following syntax:

          Dim FileName As String = Log.ExpandMacros("&[input]")

           

          If there are multiple input files you can use the following code:

           

          Dim itemList As JobLogItemList
          Dim item As JobLogItem
          Dim n As Integer
          Dim FileName As String

          If ExportCompleted Then
            itemList = Log.GetInputItems(ProjectID)
            If itemList.Count = 0 Then ' No input items exist
            Else
              n = 0 'initialize the counter
              For Each item In itemList
                  n = n + 1 'update the counter
                  FileName = item.location
                  log.addevent("Input File: " & FileName)   
              Next  
            End If
          End If