Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I will pass run date (format: yyyymmdd) during job run and i have to archive the files from a folder which are 90 days old from the run date which i have passed.
The files in the folder are of the format
abcdefgh.Dyyyymmdd.
How can this be achieved
Hi,
Sharing the whole job design along with individual component setting as well as the context variables.
Thanks
The problem is probably due to filenames.
In your initial post you were speaking about filenames like "ABCDEFGH.DyyyyMMdd" but in fact it seems there is an extension (based on your tFileList filemask which is "ABCDEFH.D*.gz").
So, change the tSetGlobalVar_2 expression with the following to remove the file extension:
(((String)globalMap.get("tFileList_2_CURRENT_FILE")).replaceAll("^.*\\.D", "")).replaceAll("\\.gz$", "")
Start with this correction but a more generic solution could be:
(((String)globalMap.get("tFileList_2_CURRENT_FILE")).replaceAll("^.*\\.D", "")).replaceAll("\\." + (String)globalMap.get("tFileList_2_CURRENT_FILEEXTENSION) + "$" , "")
In this case, if you change the extension or filemask into tFileList_1 you don't have to change anything into tFileList_2.
Hi,
Thanks for your reply and sorry for the confusion created from my end.
Actually i wanted to archive the files wherein the extension is gz (which was the reason i had included "ABCDEFH.D*.gz" in the filemask). for eg if i need to archive a file with name ABCDEFGH.DyyyyMMdd.gz.
2 things you could have found by yourself:
- for the "If" expression replace "<= 0" by "> 0"
- if you decide to use the generic solution for tSetGlobalVar_2, the correct syntax is:
(((String)globalMap.get("tFileList_2_CURRENT_FILE")).replaceAll("^.*\\.D", "")).replaceAll("\\." + (String)globalMap.get("tFileList_2_CURRENT_FILEEXTENSION") + "$" , "")
It works (tested).
Hi,
Sorry ..i am new to this. i dont understand what the new tsetglobalvar_2 will do.
why is there a "$" when i have to remove the extension of .gz from my incoming file
Hi,
Thanks for helping me understand.
in tfilelist_2 i had given context.sourcefilepath at directory and in filemask i had given context.filename.
is this where it goes wrong ?