Heesob Park
4/29/2009 6:49:00 AM
Hi,
2009/4/29 Newb Newb <revathy.p@angleritech.com>:
> Hi..
> I try to copy folders recursively..
>
> =C2=A0my_dir =3D Dir.glob( Dir.glob("#{@source}/**/*")
>
> =C2=A0my_dir.each do |f|
> =C2=A0 File.copy(f,@@dest)
> =C2=A0end
>
> For example @source =3D e:/test_dir
> If that test_dir has 10 files.if some error occurs while copying a 4th
> file,Again copying of the file should not continue from 1st file to 10th
> file again.
> =C2=A0 =C2=A0 If that 4 th file not copied due to any errors it should co=
ntinue
> copying from 5 th file and so on...
>
> I think using arrray index might do the trick.
> Any ideas
> Thanks
my_dir.each do |f|
begin
FileUtils.copy(f,@@dest)
rescue
# some error handling
end
end
Or
my_dir.each do |f|
FileUtils.copy(f,@@dest) rescue nil
end
Regards,
Park Heesob