I would use VB Script in an After Query event to rename the source file using a date component. This script is available in the script library that comes with Integration Manager. The script looks like this (from the script library)
Renaming a Source File that Uses Today's Date in its Name
How do I add an After Query script?
Copies a file and renames it, but does not delete it. The new file name includes a date component, which is convenient for keeping backups from multiple dates. You could add a time component to the file name as well.
This script assumes that the file that you want to copy is one of your source files. As a result, the script needs to be an AFTER QUERY script. (The reasoning for using an After Query script instead of an After Integration script is the After Integration script runs before the After Query script. As a result, when the integration ends, the query is still in use. If you try to rename or delete a source file in the After Integration script, it will fail because the file is still in use.)
In order to keep this script relatively simple, error handling is not included. For example, if the destination directory does not exist or is unavailable, then you will see a message that the script did not run correctly. You can build intelligent error handling into the script, but if you choose not to do so, then be sure to inform all users as to what the above message means.
Please note that this script requires that the FileSystemObject component be installed. On many Windows computers, the FileSystemObject will already be present, because it is installed as a component of some Microsoft products. If the FileSystemObject component is not present, you will see the following error: "ActiveX component can't create object."
To install the FileSystemObject:
- Find a machine that has the file called SCRUN.DLL in its system32 directory. Copy this file to your system32 directory and register it using the REGSVR32 command.
- Or, install the Windows Scripting Host, which can be downloaded from msdn.microsoft.com/scripting.
In this example, the source file is called "Orders.txt" and is in the C:\Integrate directory. It is to be copied to a subdirectory called "Done", and the name should be appended with the date, in the format "yyyymmdd". Hence, if this script is run on September 7, 2000, the Orders.txt will be copied and renamed as "Orders20000907.txt".
-----------------------------------------------------------------------------------------------------------------------------------
'Set the Path & Filename of the Source file and the Destination
'file. In this example, the destination file is named "Done 20000829",
'where "20000829" represents the system date, in the following
'format: yyyymmdd.
sSourceFile = "C:\Integrate\Orders.txt"
sDestinationFile = "C:\Integrate\Done\Orders & Year(Date) & Right("0" & Month(Date), 2) & Right("0" & Day(Date), 2) & ".txt"
'Create a File System Object
Dim pFSO
Set pFSO = CreateObject("Scripting.FileSystemObject")
'Copy and rename the file
'The "True" parameter indicates that if the file already exists
'in the destination, then it will be overwritten
Call pFSO.CopyFile(sSourceFile, sDestinationFile, True