Hi Steffen -
Thank you for that! But let me explain it a little bit better.
My target system is loaded with data for current month, current month -1, and current month -2.
Therefore, 122317 indicates the day the files were created from the source system (EBS).
For instance, on 122317, three files were dropped off in the import directory as such:
Code: Select all
Client_GL_Detail_PBCS_122317_DEC2017.txt
Client_GL_Detail_PBCS_122317_NOV2017.txt
Client_GL_Detail_PBCS_122317_OCT2017.txt
However, there are times the script may fail on the data import because an account wasn't added in the target system but exists in the source system. When the script fails on the data import, the data file isn't archived/moved. Therefore, on 12/24, the same set of files are dropped off and now an OCT file (or NOV, or DEC etc) could exist twice and we only want to load the LATEST OCT file (or NOV or DEC).
For example:
Code: Select all
Client_GL_Detail_PBCS_122417_DEC2017.txt
Client_GL_Detail_PBCS_122417_NOV2017.txt
Client_GL_Detail_PBCS_122417_OCT2017.txt
Client_GL_Detail_PBCS_122317_DEC2017.txt
Client_GL_Detail_PBCS_122317_NOV2017.txt
Client_GL_Detail_PBCS_122317_OCT2017.txt
So, I want to delete all other "OCT" files (and any other "duplicates") except for the latest ones.
Does that make sense?