Hi All,
I am using the below code for deleting file from folders, i am able to delete file from parent folder but its skipping files in sub folders:
Please check and help me getting this fixed.
-
name: Ansible delete files older than 1 minutes example
find:
paths: ‘{{diskclrpath}}’
age: ‘{{fileage}}’
patterns: ‘{{file_ext}}’
size: ‘{{file_size}}’
register: files_to_delete -
name: Ansible remove files older than a date example
file:
path: “{{ item.path }}”
state: absent
with_items: “{{ files_to_delete.files }}”
loop_control:
label: “{{ item.path }}”
when: ((diskspc_util >= ‘{{diskuseper}}’) and ( ‘rwx’ in permissionchk))