Get new files in dstdir before cp_r

Hi,

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
./subfolder1/subsub1/subsub.txt
so i have to calculate all new files.

i have tried to get the new files with =

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

but i get =

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

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 ?

Try:

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