The expression syntax for the GNU find command is very powerful. I would expect that it is up to the task. If you don’t have the GNU find command with it’s extensions I could see how it’s would be difficult.
Comment on What are the recommended scripting languages for complex shell scripts beyond bash?
CoderSupreme@programming.dev 1 year agoTemporary files management for my home folder, with archiving and cleanup after x and y days.
damium@programming.dev 1 year ago
toikpi@feddit.uk 1 year ago
As @damium@programming.dev says you may be able to do this with
find
command. This command lists all PDF files under ~/tmp that were created more than 7 days ago and does a directory listing. You could use this as a basis to move create an archive of individual files.find ~/tmp -ctime +7 -iname “*pdf” -exec ls -rlht {} \;
The
find
command also has a-delete
flag.I have in the past used this combination to implement file management. I don’t have access to the script any more. I don’t remember why we used a shell script rather than logrotate as per @oddityoverseer@lemmy.world
oddityoverseer@lemmy.world 1 year ago
You could look at logrotate if you don’t want to do something custom