# File lib/chef/provider/remote_directory.rb, line 35
      def action_create
        super
        files_to_purge = Set.new(Dir.glob(::File.join(@new_resource.path, '**', '*'),
                                          ::File::FNM_DOTMATCH).select do |name|
                                   name !~ /(?:^|#{Regexp.escape(::File::SEPARATOR)})\.\.?$/
                                 end)


        files_to_transfer.each do |cookbook_file_relative_path|
          create_cookbook_file(cookbook_file_relative_path)
          # the file is removed from the purge list
          files_to_purge.delete(::File.join(@new_resource.path, cookbook_file_relative_path))
          # parent directories are also removed from the purge list
          directories=::File.dirname(::File.join(@new_resource.path, cookbook_file_relative_path)).split(::File::SEPARATOR)
          for i in 0..directories.length-1
            files_to_purge.delete(::File.join(directories[0..i]))
          end
        end
        purge_unmanaged_files(files_to_purge)
      end