rsync based on modified time [duplicate]












0















This question already has an answer here:




  • Only use mtime comparison with rsync?

    1 answer




I am using rsync rsync $source $destination. How do I rsync based on modified time? I see an option for file size --size-only but nothing for modified time?










share|improve this question













marked as duplicate by Kusalananda, Mr Shunz, RalfFriedl, Stephen Harris, Michael Homer Dec 21 at 3:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 3




    What is it that you want to do? Do you want to update files based on only modified time? Does --update do what you want (check the manual)? What do you mean by "based on modified time"? Can you give an example?
    – Kusalananda
    Dec 17 at 19:37








  • 1




    Why would you want to worry about modified time? rsync -a (or rsync -t) will propagate times to the target and on future copy attempts simply ignore those that haven't changed.
    – roaima
    Dec 17 at 22:04










  • Just wanted to rsync files who's modified time changes. I think that is the default along with size. But I was unsure.
    – user3525290
    Dec 18 at 15:28
















0















This question already has an answer here:




  • Only use mtime comparison with rsync?

    1 answer




I am using rsync rsync $source $destination. How do I rsync based on modified time? I see an option for file size --size-only but nothing for modified time?










share|improve this question













marked as duplicate by Kusalananda, Mr Shunz, RalfFriedl, Stephen Harris, Michael Homer Dec 21 at 3:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 3




    What is it that you want to do? Do you want to update files based on only modified time? Does --update do what you want (check the manual)? What do you mean by "based on modified time"? Can you give an example?
    – Kusalananda
    Dec 17 at 19:37








  • 1




    Why would you want to worry about modified time? rsync -a (or rsync -t) will propagate times to the target and on future copy attempts simply ignore those that haven't changed.
    – roaima
    Dec 17 at 22:04










  • Just wanted to rsync files who's modified time changes. I think that is the default along with size. But I was unsure.
    – user3525290
    Dec 18 at 15:28














0












0








0








This question already has an answer here:




  • Only use mtime comparison with rsync?

    1 answer




I am using rsync rsync $source $destination. How do I rsync based on modified time? I see an option for file size --size-only but nothing for modified time?










share|improve this question














This question already has an answer here:




  • Only use mtime comparison with rsync?

    1 answer




I am using rsync rsync $source $destination. How do I rsync based on modified time? I see an option for file size --size-only but nothing for modified time?





This question already has an answer here:




  • Only use mtime comparison with rsync?

    1 answer








rsync






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 17 at 19:27









user3525290

1083




1083




marked as duplicate by Kusalananda, Mr Shunz, RalfFriedl, Stephen Harris, Michael Homer Dec 21 at 3:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Kusalananda, Mr Shunz, RalfFriedl, Stephen Harris, Michael Homer Dec 21 at 3:35


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 3




    What is it that you want to do? Do you want to update files based on only modified time? Does --update do what you want (check the manual)? What do you mean by "based on modified time"? Can you give an example?
    – Kusalananda
    Dec 17 at 19:37








  • 1




    Why would you want to worry about modified time? rsync -a (or rsync -t) will propagate times to the target and on future copy attempts simply ignore those that haven't changed.
    – roaima
    Dec 17 at 22:04










  • Just wanted to rsync files who's modified time changes. I think that is the default along with size. But I was unsure.
    – user3525290
    Dec 18 at 15:28














  • 3




    What is it that you want to do? Do you want to update files based on only modified time? Does --update do what you want (check the manual)? What do you mean by "based on modified time"? Can you give an example?
    – Kusalananda
    Dec 17 at 19:37








  • 1




    Why would you want to worry about modified time? rsync -a (or rsync -t) will propagate times to the target and on future copy attempts simply ignore those that haven't changed.
    – roaima
    Dec 17 at 22:04










  • Just wanted to rsync files who's modified time changes. I think that is the default along with size. But I was unsure.
    – user3525290
    Dec 18 at 15:28








3




3




What is it that you want to do? Do you want to update files based on only modified time? Does --update do what you want (check the manual)? What do you mean by "based on modified time"? Can you give an example?
– Kusalananda
Dec 17 at 19:37






What is it that you want to do? Do you want to update files based on only modified time? Does --update do what you want (check the manual)? What do you mean by "based on modified time"? Can you give an example?
– Kusalananda
Dec 17 at 19:37






1




1




Why would you want to worry about modified time? rsync -a (or rsync -t) will propagate times to the target and on future copy attempts simply ignore those that haven't changed.
– roaima
Dec 17 at 22:04




Why would you want to worry about modified time? rsync -a (or rsync -t) will propagate times to the target and on future copy attempts simply ignore those that haven't changed.
– roaima
Dec 17 at 22:04












Just wanted to rsync files who's modified time changes. I think that is the default along with size. But I was unsure.
– user3525290
Dec 18 at 15:28




Just wanted to rsync files who's modified time changes. I think that is the default along with size. But I was unsure.
– user3525290
Dec 18 at 15:28










2 Answers
2






active

oldest

votes


















1














Am I understanding your question correctly? 'Modified time' is one of the default criteria, when rsync decides if the copy should be updated or not.



From man rsync




Rsync finds files that need to be transferred using a "quick check"
algorithm (by default) that looks for files that have changed in size
or in last-modified time. Any changes in the other preserved
attributes (as requested by options) are made on the destination file
directly when the quick check indicates that the file’s data does not
need to be updated.







share|improve this answer





























    0














    The easiest way would be to runthe following:



    rsync -an /path/to/source /path/to/destination


    Then verify that only the desired files are going to be transferred. Once you have verified this run the above command without the -n flag and you will accomplish your goal. As pointed out by user roaima there is another flag that will accomplish your goal and that is -t. Using the -a flag is equivalent to -rlptgoD. Read all about rsync usage here.



    An alternative way would be to use the command from this answer:




     find /path/to/source -file -mtime +3 -exec rsync {} /path/to/destination ;



    So you use find to locate all files at a given $SOURCE that have a modified date as of 3 days ago. You can change -mtime +3 to however many days back you want to go. Once you have identified all files at the given $SOURCE you then execute rsync (with whatever desired options) to your $DESTINATION.






    share|improve this answer



















    • 1




      Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place.
      – roaima
      Dec 17 at 22:04












    • @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
      – kemotep
      Dec 17 at 23:11


















    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Am I understanding your question correctly? 'Modified time' is one of the default criteria, when rsync decides if the copy should be updated or not.



    From man rsync




    Rsync finds files that need to be transferred using a "quick check"
    algorithm (by default) that looks for files that have changed in size
    or in last-modified time. Any changes in the other preserved
    attributes (as requested by options) are made on the destination file
    directly when the quick check indicates that the file’s data does not
    need to be updated.







    share|improve this answer


























      1














      Am I understanding your question correctly? 'Modified time' is one of the default criteria, when rsync decides if the copy should be updated or not.



      From man rsync




      Rsync finds files that need to be transferred using a "quick check"
      algorithm (by default) that looks for files that have changed in size
      or in last-modified time. Any changes in the other preserved
      attributes (as requested by options) are made on the destination file
      directly when the quick check indicates that the file’s data does not
      need to be updated.







      share|improve this answer
























        1












        1








        1






        Am I understanding your question correctly? 'Modified time' is one of the default criteria, when rsync decides if the copy should be updated or not.



        From man rsync




        Rsync finds files that need to be transferred using a "quick check"
        algorithm (by default) that looks for files that have changed in size
        or in last-modified time. Any changes in the other preserved
        attributes (as requested by options) are made on the destination file
        directly when the quick check indicates that the file’s data does not
        need to be updated.







        share|improve this answer












        Am I understanding your question correctly? 'Modified time' is one of the default criteria, when rsync decides if the copy should be updated or not.



        From man rsync




        Rsync finds files that need to be transferred using a "quick check"
        algorithm (by default) that looks for files that have changed in size
        or in last-modified time. Any changes in the other preserved
        attributes (as requested by options) are made on the destination file
        directly when the quick check indicates that the file’s data does not
        need to be updated.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 17 at 19:38









        sudodus

        1,11616




        1,11616

























            0














            The easiest way would be to runthe following:



            rsync -an /path/to/source /path/to/destination


            Then verify that only the desired files are going to be transferred. Once you have verified this run the above command without the -n flag and you will accomplish your goal. As pointed out by user roaima there is another flag that will accomplish your goal and that is -t. Using the -a flag is equivalent to -rlptgoD. Read all about rsync usage here.



            An alternative way would be to use the command from this answer:




             find /path/to/source -file -mtime +3 -exec rsync {} /path/to/destination ;



            So you use find to locate all files at a given $SOURCE that have a modified date as of 3 days ago. You can change -mtime +3 to however many days back you want to go. Once you have identified all files at the given $SOURCE you then execute rsync (with whatever desired options) to your $DESTINATION.






            share|improve this answer



















            • 1




              Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place.
              – roaima
              Dec 17 at 22:04












            • @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
              – kemotep
              Dec 17 at 23:11
















            0














            The easiest way would be to runthe following:



            rsync -an /path/to/source /path/to/destination


            Then verify that only the desired files are going to be transferred. Once you have verified this run the above command without the -n flag and you will accomplish your goal. As pointed out by user roaima there is another flag that will accomplish your goal and that is -t. Using the -a flag is equivalent to -rlptgoD. Read all about rsync usage here.



            An alternative way would be to use the command from this answer:




             find /path/to/source -file -mtime +3 -exec rsync {} /path/to/destination ;



            So you use find to locate all files at a given $SOURCE that have a modified date as of 3 days ago. You can change -mtime +3 to however many days back you want to go. Once you have identified all files at the given $SOURCE you then execute rsync (with whatever desired options) to your $DESTINATION.






            share|improve this answer



















            • 1




              Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place.
              – roaima
              Dec 17 at 22:04












            • @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
              – kemotep
              Dec 17 at 23:11














            0












            0








            0






            The easiest way would be to runthe following:



            rsync -an /path/to/source /path/to/destination


            Then verify that only the desired files are going to be transferred. Once you have verified this run the above command without the -n flag and you will accomplish your goal. As pointed out by user roaima there is another flag that will accomplish your goal and that is -t. Using the -a flag is equivalent to -rlptgoD. Read all about rsync usage here.



            An alternative way would be to use the command from this answer:




             find /path/to/source -file -mtime +3 -exec rsync {} /path/to/destination ;



            So you use find to locate all files at a given $SOURCE that have a modified date as of 3 days ago. You can change -mtime +3 to however many days back you want to go. Once you have identified all files at the given $SOURCE you then execute rsync (with whatever desired options) to your $DESTINATION.






            share|improve this answer














            The easiest way would be to runthe following:



            rsync -an /path/to/source /path/to/destination


            Then verify that only the desired files are going to be transferred. Once you have verified this run the above command without the -n flag and you will accomplish your goal. As pointed out by user roaima there is another flag that will accomplish your goal and that is -t. Using the -a flag is equivalent to -rlptgoD. Read all about rsync usage here.



            An alternative way would be to use the command from this answer:




             find /path/to/source -file -mtime +3 -exec rsync {} /path/to/destination ;



            So you use find to locate all files at a given $SOURCE that have a modified date as of 3 days ago. You can change -mtime +3 to however many days back you want to go. Once you have identified all files at the given $SOURCE you then execute rsync (with whatever desired options) to your $DESTINATION.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Dec 17 at 23:34

























            answered Dec 17 at 19:34









            kemotep

            2,0213620




            2,0213620








            • 1




              Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place.
              – roaima
              Dec 17 at 22:04












            • @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
              – kemotep
              Dec 17 at 23:11














            • 1




              Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place.
              – roaima
              Dec 17 at 22:04












            • @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
              – kemotep
              Dec 17 at 23:11








            1




            1




            Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place.
            – roaima
            Dec 17 at 22:04






            Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place.
            – roaima
            Dec 17 at 22:04














            @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
            – kemotep
            Dec 17 at 23:11




            @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
            – kemotep
            Dec 17 at 23:11



            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre