I am struggling with listing files modified in specific month (for example, February). Here are several unsuccessful attempts:
1) I tried creating temporary files and setting their timestamp to the first time in the next month and the first time in the target month and use -newer in find, like this:
find -newer "$from" ! -newer "$to"
This lists files modified in the time interval ($from, $to], but I would like the time interval [$from, $to) (otherwise, there would be false positives on files created on the first second in the next month). Listing files modified in February is extra problem, since this would require to set one of the timestamps to the greatest one still in February, but the number of days in February varies depending on whether it is a leap year or not, which requires extra checking.
2) If I use ls I see a lot of complication when parsing, because of the possibility that user name or group contain whitespace.
Is there an easy way and relatively portable way for doing this (so it works for any month, regardless of file names, etc.)?
lsas you've discovered. – Dennis Williamson Mar 13 '11 at 14:11