Peter_Fekete_8604

How to filter out files for file transfer based on part of their name (containing date)

Discussion created by Peter_Fekete_8604 on May 31, 2017
Latest reply on May 31, 2017 by Wolfgang_Brueckler_1288

How to filter out files for file transfer based on part of their name (containing date)

 Question and restrains:

The end user requirement is to setup a file transfer object to transfer the latest file in the path on a source to destination.
- The file names have the same prefix - and ends with the date it was created.
- so every day we have new files getting added to the source with the same prefix and ending with the date it was created.
- I want to pick only the file which was created on the same day and transfer it.

 Answer

 If you really know the date of the file creation (or the transfer is on the same date) and you are sure the filename will contain the date.
You can use the process tab of the transaction to call the date function, which will give you current date.
Save it in a variable and format it.

https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/12.0/AWA%20Guides/help.htm#AE_AWA_Source/Script/ucaael.htm?

:SET &DATE# = SYS_DATE("
DD.MM.YYYY")

Then use the variable &DATE# and concatenate it into file name with the directory path, prefix and suffix and then paste it into the Source file field as attribute.

explained also in this community post by @
Wolfgang Brueckler

https://community.automic.com/discussion/5723/variable-setup-for-working-directory-of-a-job


FILE TRANSFER ATTRIBUTES:
https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/12.0/AWA%20Guides/help.htm#AWA/Objects/obj_File_Transfer_Attr.htm?

:SET &FILENAME# = "Directorypath_prefix_YYYYMMDD.suffix"
:PUT_AT FT_SRC_FILE = "&FILENAME#"

This way you do not need to hard-code the source file location and file name into the FileTransfer attribute filed and can change it ad-hoc with your script

 

You can as well incorporate wildcards * in the mix, for example in our example path

:SET &FILENAME# = "Directorypath_prefix_YYYYMMDD*"


Outcomes