[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make similar to rsync -r -t --del

From: Mike Shal
Subject: Re: make similar to rsync -r -t --del
Date: Wed, 4 Jan 2012 20:08:54 -0500

On Wed, Jan 4, 2012 at 10:24 AM, Warlich, Christof
<address@hidden> wrote:
> Hi,
> using rsync, it is rather simple to synchronize two directories:
> $ rsync -r -t --del sourcedir/ destdir
> In this example, if a file is deleted fron sourcedir, it also gets deleted 
> from destdir.
> Any other files are updated as needed.
> I want to accomplish almost the same with Make, but instead of just copying, 
> I need
> to process any source file (each in the same way) to become the corresponding
> destination file (which is why rsync cannot be used).
> The difficulty arises when a file is deleted from sourcedir: An ordinary 
> Makefile
> would just leave the corresponding (now obsolete) file being there from a 
> previous
> run of Make in destdir.
> As this problem does not seem too special to me, I wonder if anyone knows a
> good generic solution?
> Thanks for any help,
> Chris

Hi Chris,

You could try tup here ( - it is a different
build system, but it automatically removes stale files so you can
almost get it to work like rsync. An example to run '' on
each file in an input/ directory and store it in an output/ directory
would use this Tupfile:

# output/Tupfile
: foreach ../input/* |> ./ %f > %o; touch -r %f %o |> %b.translated

Then input/foo.txt becomes output/foo.txt.translated after being
processed by If you remove input/foo.txt, then the next
update will remove the corresponding output/foo.txt.translated file.
The 'touch' command is just used to mimic the rsync -t flag.

Where it falters is with the recursive flag. In tup, it would need a
Tupfile in each directory, and you would have to manually duplicate
the directory structure under the output directory. I don't know how
annoying that would be in practice.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]