6 Chef::Log.debug("Doing a remote recursive directory transfer for #{@new_resource}")
8 files_transferred = Set.new
9 files_to_transfer.each do |cookbook_file_relative_path|
10 create_cookbook_file(cookbook_file_relative_path)
11 files_transferred << ::File.dirname(::File.join(@new_resource.path, cookbook_file_relative_path))
12 files_transferred << ::File.join(@new_resource.path, cookbook_file_relative_path)
14 if @new_resource.purge
15 files_to_purge = Set.new(
16 Dir.glob(::File.join(@new_resource.path, '**', '*'), ::File::FNM_DOTMATCH).select do |name|
17 name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
20 files_to_purge = files_to_purge - files_transferred
21 purge_unmanaged_files(files_to_purge)