0

我有以下文件结构:

- Parent
  - folder1
     - file1
  - folder2
     - file2
  - folder3
     - file3

我希望将文件 1、文件 2、文件 3 移动到父目录。问题是找出父目录中的所有目录。我正在尝试实现这样的东西:

- name: Moving file.
  command: mv /parent/{{item}}/* /parent
  with_items: "folders in parent"

任何方法对我来说都很好。我没有任何线索。

4

1 回答 1

1

您可以使用with_fileglob

- name: Moving file.
  command: mv {{ item }} /parent/
  with_fileglob:
    - /parent/*/*
于 2016-02-15T11:26:32.433 回答