I need to get the list of files(.log/.lst) present in a directory($logfolder) whose creation date is in a specific $year and $month
stat  --format='%y %n'  $logfolder/* |
  grep "$year-$month-"|
  awk -F' ' '{print $4}'|
  grep 'log$\|lst$' > $archivepath/filesToArchive
            
This doesn't work when I query the command to a folder where there are too many files. I get the following error:
-bash: /usr/bin/stat: Argument list too long