Shell Script — Get all files modified after

前端 未结 9 2493
礼貌的吻别
礼貌的吻别 2020-12-12 09:57

I\'d rather not do this in PHP so I\'m hoping a someone decent at shell scripting can help.

I need a script that runs through directory recursively and finds all fil

9条回答
  •  伪装坚强ぢ
    2020-12-12 10:26

    I would simply do the following to backup all new files from 7 days ago

    tar --newer $(date -d'7 days ago' +"%d-%b") -zcf thisweek.tgz .
    

    note you can also replace '7 days ago' with anything that suits your need

    Can be : date -d'yesterday' +"%d-%b"

    Or even : date -d'first Sunday last month' +"%d-%b"

提交回复
热议问题