Sample Header Ad - 728x90

Search directories containing numbers larger than a certain threshold in their name

3 votes
1 answer
259 views
This is the command that I have and would like to modify with an additional condition: find /home/user/backups/ -mindepth 2 -maxdepth 3 -name "*~EEEE000.tif" -print This is the output of ls /home/user/backups/: backup20170101_somerandomstring backup20170115_somerandomstring backup20170230_somerandomstring backup20170305_somerandomstring backup20170408_somerandomstring backup20170521_somerandomstring . . . backup20190111_somerandomstring backup20190130_somerandomstring backup20190209_somerandomstring backup20190301_somerandomstring backup20190303_somerandomstring backup20190311_somerandomstring backup20190313_somerandomstring backup20190412_somerandomstring . . . backup20200102_somerandomstring backup20200103_somerandomstring backup20200105_somerandomstring backup20200110_somerandomstring . . . I only want to search directories that were generated after 2019-03-10. So this can be easily thought of as **directories** **which in their name have numbers larger than 20190310 right after the word backup**. I can thin of seq but do not know how to use it alongside find. And I am sure there are better options out there. seq -f "backup%1.0f" 20190310 20200131
Asked by paropunam (267 rep)
Jan 30, 2020, 10:17 AM
Last activity: Jan 30, 2020, 11:19 AM