4

In order to use some data that are stored and produced remotely I first download them via scp servername:/.../big_directory/* ~/. There are many files and the command includes everything. These files change unpredictably (for me), however it's just a few (over MANY) that actually change between a download and the next. Is there a way to compare them one by one with the ones that I already have locally, as in if diff file_in_the_server local_file_with_the_same_name returns zero then skip or something like that? It would be time saving and revolutionary here. I presume that it's not possible since, in order to compare them, some download must be done in a way or the other, however I'm asking anyway to be sure since this is wizardry for me anyway

Thank you very much in advance

1 Answer 1

4

You're looking for rsync with the -u option. From man rsync:

       --update, -u
              This forces rsync to skip any files which exist on the destina‐
              tion and have a modified time that is  newer  than  the  source
              file.  (If an existing destination file has a modification time
              equal to the source file's, it will be updated if the sizes are
              different.)

So your full command would be:

rsync -u servername:/.../big_directory/* ~/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .