Get new files in dstdir before cp_r


i have a workflow that copies folders with FileUtils.cp_r
over to an existing cvs workspace.

As cvs CLI lacks a recursive flag for add command,
i have to add all new folders and files separately in
a spaceseparated list, i.e.

cvs add ./subfolder1 ./subfolder1/subsub1
so i have to calculate all new files.

i have tried to get the new files with =

def copy_dir(dir)
Dir.glob("#{dir}/**/[^coinfo.txt].").each do | i |
if not File.exist?("#{CVSWORKSPACE}/#{i}")
puts “new file detected ==> #{i}”

but i get =

new file detected ==> Y:/test_deploy/4804/subfolder7/subsub7/bla.txt
new file detected ==>
new file detected ==> Y:/test_deploy/4804/subfolder7/subsub6/subsub6.txt
new file detected ==>

means the whole path, where i would need the space separated list like
that =

/subfolder7 /subfolder7/subsub7 /subfolder7/subsub7/bla.txt …

How to achieve that ?

As i use the FileUtils.cp_r method later =
doesn’t this method not already know internally which files are new ?

Regards, Gilbert

On Tue, Feb 27, 2007 at 07:36:26PM +0900, Rebhan, Gilbert wrote:

that =

/subfolder7 /subfolder7/subsub7 /subfolder7/subsub7/bla.txt …

How to achieve that ?


Dir.chdir(dir) do
Dir.glob("**/[^coinfo.txt].").each do |i|
puts i

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs