Search code examples
ubuntufilenamesrsync

Ubuntu rsync specific filenames


I have running a cronjob once a day which rsyncs files from an online storage to my local directory names /local/data. Now, I would like to rsync only files from different folders with a specific name, here is an example of my problem:

The online directory is of the structure

/data
 /ID1
  /"191201.csv"
  .
  .
  /"200314.csv"
 /ID2
  /"191201.csv"
  .
  .
  /"200314.csv"
 .
 .
 /IDn
  /...

The filename is always a date so e.g. 200314 is 20st of march 2014. So now I would like to rysnc only files from "200101" in every folder.

Is this possible with an rsync in Ubuntu and if yes how would the command looks like?

Thanks for any hints!


Solution

  • rsync supports --include=PATTERN or --files-from=FILE, see the file filtering section of this link

    https://www.lostsaloon.com/technology/11-simple-rsync-examples-that-you-can-use-to-be-more-productive/