# compare dates in filenames to variable

**URL:** <https://forum.ansible.com/t/compare-dates-in-filenames-to-variable/21874>\
**Category:** Ansible Project\
**Created:** [June 28, 2016, 11:20am UTC](https://forum.ansible.com/t/compare-dates-in-filenames-to-variable/21874 "2016-06-28T11:20:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Przytula](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Guy\_Przytula](https://forum.ansible.com/u/Guy_Przytula)\
**Post date:** [June 28, 2016, 11:20am UTC](https://forum.ansible.com/t/compare-dates-in-filenames-to-variable/21874/1 "2016-06-28T11:20:17Z")

</div>

we are using an older version of ansible 1.4 (Because we had a problem after upgarde) on linux and targetting linux and aix

I have a question about how to :  
having a folder with filenames like : SAP500.4.db2istm5.DBPART000.20160628120023.001 keeping a date 20160628  
in the playbook we collect a variable : eg 20160627

we only want to copy files to another directory if the file has a date equal to variable or more recent  
eg. 20160627-20160628-20160629… all these dates would do…  
if anybody has a sample code how to achieve this, please share  
I have tried with date -d function but -d is not supported on aix (even in bash)…

thanks for all update/help  
Best Regards, Guy Przytula
