Doomdoxrulz

joined 1 year ago
[โ€“] Doomdoxrulz@lemmy.ml 1 points 1 year ago* (last edited 1 year ago)

The first command (ls -1 /backup/*.dump) just creates a list of files in the backup folder that have the extension .dump. the output of the prior command is then sent to the next command (head -n -2) this cuts the list down to everything except the last 2 items in the list this is then sent to the final command which takes the list and runs the final (rm -f) command with the items in the list as the targets to delete.

heres a solution based on this post https://stackoverflow.com/questions/25785/delete-all-but-the-most-recent-x-files-in-bash

ls -tp /backup/*.dump | grep -v '/$' | tail -n +4 | tr '\n' '\0' | xargs -0 rm -f

There is an explanation on that post that explains it in better detail but in simple terms it deletes all files but the most recent 3 files in the directory that have the .dump extension

[โ€“] Doomdoxrulz@lemmy.ml 4 points 1 year ago

seems like they are waiting on the adoption process to be finished

https://github.com/orgs/opentffoundation/projects/3