I have visited several answers covering rsync and patterns, but couldn't find a solution to this particular problem. Assume that we've got a directory structure like the following on a remote machine, and we'd like to rsync that to a local directory. It's like mirroring only the "LATEST" part of a remote directory.
root |-dir_a | |-LATEST -> version_3 | |-version_1 | |-version_2 | `-version_3 |-dir_b | |-LATEST -> version_1 | `version_1 `dir_c |-LATEST -> version_3 |-version_1 |-version_2 `-version_3
LATEST is a symlink, and always points to the latest version on remote. I am currently trying to process
rsync --list-only output with a shell script, and synchronize only LATEST versions. That's somewhat painful. It's a hunch; I believe that there is a way to do this with just some
--exclude patterns. Could someone help me writing a set of patterns that can do this?
Also, I'd prefer finding a way to remove an old version that's not LATEST anymore. My script goes through directories, and finds directories other than what LATEST symlinks to, and removes them. Is that possible with rsync?