开发者

Extra Copy of New Rsync Files

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 addition开发者_开发百科al 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.


You might consider making hardlinks in the extra directory.

ln --force --target-directory=~/staging ~/mirror/*

Edit:

If this is a Linux system, incron will trigger on inotify events and would allow you to make copies of files as they are added to a directory you specify.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜