N
Nick Sabalausky
I had a need to do a filtered directory-tree copy, but didn't see
anything in the std lib docs (or from googling) other than
FileUtils.cp_r which doesn't do filtering, so I made alternate versions
of that and FileUtils.copy_entry that do filtering.
Ordinarily, I'd try to form it into something appropriate for potential
inclusion in the official lib and submit a patch, but I'm still enough
of Ruby novice that I don't really have enough of a feel for what
exactly would be a "proper" way to integrate the feature, so I'm posting
(attaching) it here as-is in the hopes that someone may at least find it
useful. (FWIW, this is modified from the implementations in fileutils.rb
from Ruby 1.9.1p378).
Attachments:
http://www.ruby-forum.com/attachment/4467/filteredCopy.rb
anything in the std lib docs (or from googling) other than
FileUtils.cp_r which doesn't do filtering, so I made alternate versions
of that and FileUtils.copy_entry that do filtering.
Ordinarily, I'd try to form it into something appropriate for potential
inclusion in the official lib and submit a patch, but I'm still enough
of Ruby novice that I don't really have enough of a feel for what
exactly would be a "proper" way to integrate the feature, so I'm posting
(attaching) it here as-is in the hopes that someone may at least find it
useful. (FWIW, this is modified from the implementations in fileutils.rb
from Ruby 1.9.1p378).
Attachments:
http://www.ruby-forum.com/attachment/4467/filteredCopy.rb