Skip to content

Copying with copy task folders raises IsADirectoryError #8

@corentincharron

Description

@corentincharron

Hello,

Problem

I'm trying to use the copy task in order to copy folders, but if I provide directories to src and dest, it raises a IsADirectoryError (I'm on Linux).

This is probably not a bug for the Ansible copy task seems to be for files only.

Ansible equivalent for "copying" directories seems to be the synchronize task, which is a wrapper around rsync.

But technically it's not the same, and being able to both copy and sync directories would be very useful.

Proposal

I'm willing to give it a try myself, but I'd like your opinion first:

  • Add directories support to copy task?
  • Create a new task copy_dir?

Also there are two commons cases that needs to be handled:

  • Copy source to destination
  • Copy source's content to destination (my use case today)

Regarding preservation, there are two cases to handle as well:

  • Erase destination's content first
  • Merge with existing destination's content

I could also give a go to implementing asynchronize equivalent, but it's less of need for me, and it would require some more thinking for it's using os-specific commands (I believe there is a Windows equivalent to rsync though)

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions