tar -cvzf a.tar.gz a --remove-files
[root@nfs01 backup]# tar -zcvf 88.tar.gz --remove-files /backup/*
tar: Removing leading `/' from member names
/backup/10.txt
/backup/1.txt
/backup/2.txt
/backup/3.txt
/backup/4.txt
/backup/5.txt
/backup/6.txt
/backup/7.txt
/backup/8.txt
/backup/9.txt
先创建tar包最后删除
/backup/ OPEN,ISDIR
/backup/ CLOSE_NOWRITE,CLOSE,ISDIR
/backup/88.tar.gz CREATE
/backup/88.tar.gz OPEN
/backup/88.tar.gz MODIFY
/backup/88.tar.gz CLOSE_WRITE,CLOSE
/backup/10.txt DELETE
/backup/1.txt DELETE
/backup/2.txt DELETE
/backup/3.txt DELETE
/backup/4.txt DELETE
/backup/5.txt DELETE
/backup/6.txt DELETE
/backup/7.txt DELETE
/backup/8.txt DELETE
/backup/9.txt DELETE
=====================================
[root@nfs01 backup]# inotifywait -mrq --format="%w%f%e" /backup/
/backup/OPEN,ISDIR
/backup/CLOSE_NOWRITE,CLOSE,ISDIR
/backup/88.tar.gzCREATE
/backup/88.tar.gzOPEN
/backup/88.tar.gzMODIFY
/backup/88.tar.gzCLOSE_WRITE,CLOSE
/backup/10.txtDELETE
/backup/1.txtDELETE
/backup/2.txtDELETE
/backup/3.txtDELETE
/backup/4.txtDELETE
/backup/5.txtDELETE
/backup/6.txtDELETE
/backup/7.txtDELETE
/backup/8.txtDELETE
/backup/9.txtDELETE