我需要在Git存储库下标识更新的.csv文件以及路径名,并将文件名写入.csv文件。
尝试了git diff --name-only --diff-filter=AMDR --cached @~..@
命令,但没有任何区别。建议您使用任何建议的bash / ansible脚本或git命令。
---
- name: Find files
find:
paths: /tmp
patterns: "*.csv"
age: "2m"
recurse: yes
register: files_to_changed
- shell: "cp {{ item }} {{item}}_bkp"
with_items:
- "{{ files_to_changed }}"
使用的命令:-ansible-playbook ansible/plays/find/find.yml
我已将代码拖到/tmp
文件夹下,并使用find命令检查文件的年龄,但是当我执行此命令时,我不确定输出的确切位置。我想将更改后的文件名复制到.csv并将其发送到S3存储桶
输出:-
PLAY [127.0.0.1] *************************************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************************************
ok: [127.0.0.1]
TASK [../../roles/airflow : Ansible find file examples] **********************************************************************************************************
ok: [127.0.0.1]
TASK [../../roles/airflow : debug] *******************************************************************************************************************************
ok: [127.0.0.1] => {
"msg": [
{
"atime": 1549222753.577,
"ctime": 1549222765.26,
"dev": 64768,
"gid": 0,
"gr_name": "root",
"inode": 16982785,
"isblk": false,
"ischr": false,
"isdir": false,
"isfifo": false,
"isgid": false,
"islnk": false,
"isreg": true,
"issock": false,
"isuid": false,
"mode": "0644",
"mtime": 1549222765.254,
"nlink": 1,
"path": "/tmp/iam.csv",
"pw_name": "root",
"rgrp": true,
"roth": true,
"rusr": true,
"size": 78,
"uid": 0,
"wgrp": false,
"woth": false,
"wusr": true,
"xgrp": false,
"xoth": false,
"xusr": false
}
]
}