# Copying changed files in a tree

**URL:** <https://www.ruby-forum.com/t/copying-changed-files-in-a-tree/84492>\
**Category:** Ruby\
**Created:** [February 5, 2007, 10:09am UTC](https://www.ruby-forum.com/t/copying-changed-files-in-a-tree/84492 "2007-02-05T10:09:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [February 5, 2007, 10:09am UTC](https://www.ruby-forum.com/t/copying-changed-files-in-a-tree/84492/1 "2007-02-05T10:09:02Z")

</div>

Do any of the ruby build tools (rake, rant, somethingelse?) support  
the task “copy all the files that have changed since the last time i  
ran the copy task” across an entire directory tree? e.g. if I have the  
structure

foo/  
foo/file1  
foo/file2  
foo/bar/  
foo/bar/file3

the first time i run rake copy, it should copy the entire tree over.  
Now say I touch foo/bar/file3, and rerun rake copy, it should only  
copy that file over.

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [February 5, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/copying-changed-files-in-a-tree/84492/2 "2007-02-05T13:23:25Z")

</div>

On 2/5/07, Ryan D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Feb 5, 2007, at 1:08 AM, Martin DeMello wrote:
> 
> > Do any of the ruby build tools (rake, rant, somethingelse?) support  
> > the task “copy all the files that have changed since the last time i  
> > ran the copy task” […]
> 
> use rsync. it rules.

good point 🙂 i was trying too hard for a pure ruby solution.

martin

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [February 5, 2007, 10:27am UTC](https://www.ruby-forum.com/t/copying-changed-files-in-a-tree/84492/3 "2007-02-05T10:27:06Z")

</div>

On Feb 5, 2007, at 1:08 AM, Martin DeMello wrote:

> Do any of the ruby build tools (rake, rant, somethingelse?) support  
> the task “copy all the files that have changed since the last time i  
> ran the copy task” […]

use rsync. it rules.

---

<div class="post-metadata">

**Author:** ![Martin\_DeMello](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f17d59/32.png) [@Martin\_DeMello](https://www.ruby-forum.com/u/Martin_DeMello)\
**Post date:** [February 5, 2007, 1:50pm UTC](https://www.ruby-forum.com/t/copying-changed-files-in-a-tree/84492/4 "2007-02-05T13:50:26Z")

</div>

On 05.02.2007 13:22, Martin DeMello wrote:

> good point 🙂 i was trying too hard for a pure ruby solution.  
> GNU cp also has some nice options to deal with this (from memory, -a and  
> -u).

Kind regards

robert
