I want to automate one task in UNIX and make one script.
There is a directory in which everyday 2 files come and that files come anytime in between 10pm to 1am.
The file name is something like batm53_20131025_BARC5300001201310240000000200004233.221341696408
.
If you see a filename has 3 parts:
- batm53 which is constant
- date when file arrive in directory
- this part is BARC5300001201310170000000200004233.221341696408 in which BAR5300001 is constant and then after date of file.
Suppose today is 24th Oct and file come after 1am then second part of filename shows 25th Oct but in third part after BAR5300001 it shows 24th Oct date ( 20131024).
I'm facing issue in this scenario. If file comes in between 10pm to 12am then I can make script easy with help of find command but I'm facing issue in making that part. How can I check if file comes after 12am because that file should be previous date and after 12am date should change?