How can I find space occupied by the incoming files for a date range,

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












My requirement is to find the space consumed and count of incoming files every month. So say If I have a directory "X" I would like to know the space and for the month of November



Following is the command we used to get the details.



cd x
Output1=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | wc -l)
Output2=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | du -sk)
echo "Count of file is $Output1 and Space occupied by files is $Output2 KB"


We ran the above command for 3 different ranges a) 1 Oct to 31st Oct , b) 1st Oct to 30th Nov, and c) 1st Nov to 30th Nov.



My expectation was a) + b) should be = C but it is not. Can you please share your views on this. Or can you please let me know if there is anything wrong with the command I am using. Or Please share if you have a better option for my requirement.



Count of file is 3679280 and Space occupied by files is 19766351768
Count of file is 6857725 and Space occupied by files is 19765912668
Count of file is 3063226 and Space occupied by files is 19765541452







share|improve this question


























    up vote
    0
    down vote

    favorite












    My requirement is to find the space consumed and count of incoming files every month. So say If I have a directory "X" I would like to know the space and for the month of November



    Following is the command we used to get the details.



    cd x
    Output1=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | wc -l)
    Output2=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | du -sk)
    echo "Count of file is $Output1 and Space occupied by files is $Output2 KB"


    We ran the above command for 3 different ranges a) 1 Oct to 31st Oct , b) 1st Oct to 30th Nov, and c) 1st Nov to 30th Nov.



    My expectation was a) + b) should be = C but it is not. Can you please share your views on this. Or can you please let me know if there is anything wrong with the command I am using. Or Please share if you have a better option for my requirement.



    Count of file is 3679280 and Space occupied by files is 19766351768
    Count of file is 6857725 and Space occupied by files is 19765912668
    Count of file is 3063226 and Space occupied by files is 19765541452







    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      My requirement is to find the space consumed and count of incoming files every month. So say If I have a directory "X" I would like to know the space and for the month of November



      Following is the command we used to get the details.



      cd x
      Output1=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | wc -l)
      Output2=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | du -sk)
      echo "Count of file is $Output1 and Space occupied by files is $Output2 KB"


      We ran the above command for 3 different ranges a) 1 Oct to 31st Oct , b) 1st Oct to 30th Nov, and c) 1st Nov to 30th Nov.



      My expectation was a) + b) should be = C but it is not. Can you please share your views on this. Or can you please let me know if there is anything wrong with the command I am using. Or Please share if you have a better option for my requirement.



      Count of file is 3679280 and Space occupied by files is 19766351768
      Count of file is 6857725 and Space occupied by files is 19765912668
      Count of file is 3063226 and Space occupied by files is 19765541452







      share|improve this question














      My requirement is to find the space consumed and count of incoming files every month. So say If I have a directory "X" I would like to know the space and for the month of November



      Following is the command we used to get the details.



      cd x
      Output1=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | wc -l)
      Output2=$(find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30 | du -sk)
      echo "Count of file is $Output1 and Space occupied by files is $Output2 KB"


      We ran the above command for 3 different ranges a) 1 Oct to 31st Oct , b) 1st Oct to 30th Nov, and c) 1st Nov to 30th Nov.



      My expectation was a) + b) should be = C but it is not. Can you please share your views on this. Or can you please let me know if there is anything wrong with the command I am using. Or Please share if you have a better option for my requirement.



      Count of file is 3679280 and Space occupied by files is 19766351768
      Count of file is 6857725 and Space occupied by files is 19765912668
      Count of file is 3063226 and Space occupied by files is 19765541452









      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 7 '17 at 9:42









      ilkkachu

      50.1k676138




      50.1k676138










      asked Dec 7 '17 at 7:55









      Anush

      1




      1




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          -newermt 2017-10-31 means "modified after October 31st, 00:00",
          ! -newermt 2017-10-31 means "modified before or on October 31st, 00:00"
          so the latter does not include files made during the day of October 31st. If you use -newermt 2017-10-01 ! -newermt 2017-10-31, you'll miss the last day of the month.



          $ find . -type f -newermt 2017-10-01 ! -newermt 2017-10-31
          ./oct30
          $ find . -type f -newermt 2017-10-01 ! -newermt 2017-11-30
          ./oct30
          ./oct31
          ./nov01
          $ find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30
          ./nov01


          You probably want -newermt 2017-10-01 ! -newermt 2017-11-01 to get the whole of October, but note that files created on exactly on midnight between Oct 31st and Nov 1st count for October. (This will probably not be an issue on any system with subsecond timestamps.)






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409409%2fhow-can-i-find-space-occupied-by-the-incoming-files-for-a-date-range%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            -newermt 2017-10-31 means "modified after October 31st, 00:00",
            ! -newermt 2017-10-31 means "modified before or on October 31st, 00:00"
            so the latter does not include files made during the day of October 31st. If you use -newermt 2017-10-01 ! -newermt 2017-10-31, you'll miss the last day of the month.



            $ find . -type f -newermt 2017-10-01 ! -newermt 2017-10-31
            ./oct30
            $ find . -type f -newermt 2017-10-01 ! -newermt 2017-11-30
            ./oct30
            ./oct31
            ./nov01
            $ find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30
            ./nov01


            You probably want -newermt 2017-10-01 ! -newermt 2017-11-01 to get the whole of October, but note that files created on exactly on midnight between Oct 31st and Nov 1st count for October. (This will probably not be an issue on any system with subsecond timestamps.)






            share|improve this answer
























              up vote
              0
              down vote













              -newermt 2017-10-31 means "modified after October 31st, 00:00",
              ! -newermt 2017-10-31 means "modified before or on October 31st, 00:00"
              so the latter does not include files made during the day of October 31st. If you use -newermt 2017-10-01 ! -newermt 2017-10-31, you'll miss the last day of the month.



              $ find . -type f -newermt 2017-10-01 ! -newermt 2017-10-31
              ./oct30
              $ find . -type f -newermt 2017-10-01 ! -newermt 2017-11-30
              ./oct30
              ./oct31
              ./nov01
              $ find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30
              ./nov01


              You probably want -newermt 2017-10-01 ! -newermt 2017-11-01 to get the whole of October, but note that files created on exactly on midnight between Oct 31st and Nov 1st count for October. (This will probably not be an issue on any system with subsecond timestamps.)






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                -newermt 2017-10-31 means "modified after October 31st, 00:00",
                ! -newermt 2017-10-31 means "modified before or on October 31st, 00:00"
                so the latter does not include files made during the day of October 31st. If you use -newermt 2017-10-01 ! -newermt 2017-10-31, you'll miss the last day of the month.



                $ find . -type f -newermt 2017-10-01 ! -newermt 2017-10-31
                ./oct30
                $ find . -type f -newermt 2017-10-01 ! -newermt 2017-11-30
                ./oct30
                ./oct31
                ./nov01
                $ find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30
                ./nov01


                You probably want -newermt 2017-10-01 ! -newermt 2017-11-01 to get the whole of October, but note that files created on exactly on midnight between Oct 31st and Nov 1st count for October. (This will probably not be an issue on any system with subsecond timestamps.)






                share|improve this answer












                -newermt 2017-10-31 means "modified after October 31st, 00:00",
                ! -newermt 2017-10-31 means "modified before or on October 31st, 00:00"
                so the latter does not include files made during the day of October 31st. If you use -newermt 2017-10-01 ! -newermt 2017-10-31, you'll miss the last day of the month.



                $ find . -type f -newermt 2017-10-01 ! -newermt 2017-10-31
                ./oct30
                $ find . -type f -newermt 2017-10-01 ! -newermt 2017-11-30
                ./oct30
                ./oct31
                ./nov01
                $ find . -type f -newermt 2017-11-01 ! -newermt 2017-11-30
                ./nov01


                You probably want -newermt 2017-10-01 ! -newermt 2017-11-01 to get the whole of October, but note that files created on exactly on midnight between Oct 31st and Nov 1st count for October. (This will probably not be an issue on any system with subsecond timestamps.)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 7 '17 at 9:42









                ilkkachu

                50.1k676138




                50.1k676138



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f409409%2fhow-can-i-find-space-occupied-by-the-incoming-files-for-a-date-range%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?