Skip to main content
6 of 6
deleted 31 characters in body
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 237

"/usr/bin/stat: Argument list too long" error

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
DCL
  • 51
  • 2