I am very new to bash scripting, so bear with me, please. I need to collect, compress and delete files in the archive directory of a directory tree older than 30 days old for each respective folder. The directory structure looks like this ...
root
-export
--client01
---archive
-process
--client01
---834
----archive
---835
----archive
---837
----archive
In each archive folder I need to create timestamped tar/zip with files 30 days or older in the tar/zip file before I delete them (i.e., 20190730_111543.zip
)
Hope this makes sense.
--client01
? – tink Jul 30 '19 at 17:52tree dirname
to show the tree structure of the named directory – Valentin Bajrami Jul 30 '19 at 20:10for dir in $(find . -type d -iname 'archive'); do cd $dir find . -type f ! -iname '*.tar.gz' -mtime +28 | tar -czvf "$(date '+%Y%m%d_%H%M%S').tar.gz" --null -T -; done
– Lucas Davenport Aug 05 '19 at 14:11