How to rename the file name to include the date and time after transferred by Control-M for Advanced File Transfer (AFT)?

Version 1
    Share:|

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    Control-M for Advanced File Transfer


    COMPONENT:

    Control-M for Advanced File Transfer


    APPLIES TO:

    All version of BMC Control-M for Advanced File Transfer



    QUESTION:

    Questions:
    - When using Control-M for Advanced File Transfer, how can you rename the file and put the date and time in the file name?
    - How to rename the file name to include the date and time after transferred by Control-M for Advanced File Transfer (AFT)?
    - How to add Autoedit %%$ODATE and %%TIME to the filename after a successful File Transfer job?

    Details:
    - To rename a file to include date and time after a successful File Transfer job.
    - To update <FILENAME>.<EXT> to become <FILENAME><DATE><TIME>.<EXT>
    - Need to be able to add the %%$ODATE and %%TIME to the filename after the file transfer
     


    ANSWER:

    Answer:
    Control-M for Advanced File Transfer has Autoedits/Variables that are set when the file is transferred. 
    The Autoedits/Variables are listed in the Control-M for Advanced File Transfer Administrator Guide.
    These Autoedits/Variables can be used in the job under the Advanced Tab -> General Tab -> After Completion. You can locate Advanced Tab when defining a File Transfer Job. Once clicked on Advanced  tab ,the Advanced dialog box appears

    - The following AFT variables exist for renaming source or destination files after the transfer completes:
       $$AFTFILE$$: full file name (preserves extension)
       $$AFTFILE_ALL$$: full file name including the extension
       $$AFTFILE_NAME$$: name of the file until the last dot (without the extension)
       $$AFTFILE_EXT$$: the extension of the file name


    - The following syntax will postpend the date and time to the original filename:
       $$AFTFILE_ALL$$.%%DATE.%%TIME
       Following is an example for the rename:
       Original file name:  filename.out.
       Result file name: filename.out.150508115632

    - The following syntax will put the date time in the middle of the file and keep the extension:
       $$AFTFILE$$.%%DATE.%%TIME..$$AFTFILE_EXT$$
       Following is an example for the rename:
       Original file name:  filename.out.
       Result file name: filename.150508115632..out.

    - The following syntax will post append the date and time between original filename and file extension:
      $$AFTFILE$$_%%DATE.%%TIME
      Following is an example for the rename to using Filename.YYYYMMDD.Extension format: 
      Original filename:  filename.out
      Result filename: filename_20160508115632.out


    For more information on using AFT variables, see video article:
    In Control-M for Advanced File Transfer can I use variables to rename renaming source or destination files after the transfer completes when using wildcard transfers? 
     


    Article Number:

    000016979


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles