新 Rsync 文件的额外副本
我正在尝试使用 rsync 镜像远程服务器上的目录。但是,我希望将所有新创建的文件的副本存储在本地计算机上的单独目录中。
例如,如果在远程服务器上添加了一个新文件,我希望它定期镜像(例如,到 ~/mirror),但仅在另一个文件夹中保存新文件的附加副本(例如,~ /分期)。需要明确的是,只有新文件应该出现在暂存中。
我的第一个方法是允许 rsync 更新时间戳,然后使用它来制作副本。但是,我现在想保留时间戳。
任何人都可以提供有关简单方法的想法吗?我愿意使用除 rsync 之外的其他实用程序。
I am attempting to mirror a directory on a remote server using rsync. However, I would like a copy of all newly created files to be stored in a separate directory on the local machine.
For example, if a new file is added on the remote server, I would like it to mirror regularly (for example, to ~/mirror), but save an additional copy of only the new file in another folder, (for example, ~/staging). To be clear, only the new files should appear in staging.
My first approach was to allow rsync to update the timestamps, and then use that to make a copy. However, I would now like to preserve timestamps.
Can anyone provide ideas on a simple approach? I am open to use of additional utilities other than rsync.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以考虑在额外的目录中创建硬链接。
编辑:
如果这是 Linux 系统,
incron
将触发inotify
事件,并允许您在将文件添加到您指定的目录时对其进行复制。You might consider making hardlinks in the extra directory.
Edit:
If this is a Linux system,
incron
will trigger oninotify
events and would allow you to make copies of files as they are added to a directory you specify.