Calculate the size of the files established on 21 July



  • There's a file in it. /Archive There's 10,000 files, we need to find all the files that were created on 21 July and count them.

    $ ls -l | grep -c "Jul 21" 
    

    How can you do that?


    It doesn't work.

    $ for i in ls -l | grep "Jul 21" | awk '{print $NF}'; do AB=0; AB=du -sh $i | awk '{print $1}' | sed 's/K//g' | cut -d. -f 1; SUM=expr $AB + $SUM ; done
    


  • The files created on 21 July 2016 can be found, for example:

    $ find /archive -newerct 2016-07-21 \! -newerct 2016-07-22
    

    The total size can be calculated, for example, the programme du..about:

    $ find /archive -newerct 2016-07-21 \! -newerct 2016-07-22 -print0 | xargs -0 du -ch | tail -n 1
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2