Shell Script — Get all files modified after

前端 未结 9 2502
礼貌的吻别
礼貌的吻别 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:12

    as simple as:

    find . -mtime -1 | xargs tar --no-recursion -czf myfile.tgz
    

    where find . -mtime -1 will select all the files in (recursively) current directory modified day before. you can use fractions, for example:

    find . -mtime -1.5 | xargs tar --no-recursion -czf myfile.tgz
    

提交回复
热议问题