I have files that starting with YYYYMMDD like the following:
20160221_143223_Report.csv
20160222_121223_Report.csv
...
20160229_141223_Report.csv
20160301_171223_Report.csv
I want to tar files that has "Report" in filename and that files are in 8 days ago, today is 1st of March, so i want to tar files from 22th Feb to 29th Feb (today not inclusive).
files=($(ls |<HAS "Report" in filename> and <WITHIN `date -d "8 days ago" '+%Y%m%d'> )) #output will be filenames that has the word "Report" and from 22th to 29th FEB
tar cvfz oldfile.tar.gz "${files[@]}"
What is the patte that i can match?
- - , .
برچسب:
نویسنده: استخدام کار