Timeline for Test if File was Modified After Date in File Name
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 29, 2015 at 8:15 | history | edited | meuh | CC BY-SA 3.0 |
macos, less bash
|
| Oct 29, 2015 at 8:08 | comment | added | meuh |
If your bash doesnt work with if [[=~]] you can try the basic if filedate=$(expr "$file" : '.*-\([0-9]*\).txt') and then replace ${BASH_REMATCH[1]} by $filedate.
|
|
| Oct 29, 2015 at 7:58 | comment | added | meuh |
It looks for the 8 digits followed by .txt at the end of the filename. The parentheses () captures the 8 digits part, and you can find it in ${BASH_REMATCH[1]}.
|
|
| Oct 29, 2015 at 7:46 | comment | added | Peter Grill |
With the change in the stat as per your comment, things seem to execute but no output for all test cases. But, what is the "$file" =~ ([0-9]{8}).txt$ doing?
|
|
| Oct 29, 2015 at 7:14 | comment | added | meuh |
My bad. The equivalent seems to be stat -f %m -t %F "$file". Sorry, I can't test it.
|
|
| Oct 29, 2015 at 3:33 | comment | added | Peter Grill |
MacOS 10.9.5 does not seem to have the -c option to stat.
|
|
| Oct 26, 2015 at 8:57 | history | answered | meuh | CC BY-SA 3.0 |