From 79c8d21ca871e2f52d8de960cbf2534ba4509491 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Thu, 13 May 2010 16:41:30 -0400 Subject: [PATCH] Add garbage collection at the end of each run. You can trivially invoke the garbage collector by redirecting stdin to /dev/null. --- dm6 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dm6 b/dm6 index c6f93d9..874534f 100755 --- a/dm6 +++ b/dm6 @@ -186,6 +186,15 @@ while () { warn "$file: $@" if $@; } +# Garbage collection +print STDERR "\nGarbage collection in '$link_dir'..."; +chdir($link_dir) || die "chdir: $link_dir: $!"; +print STDERR "\nRemoving files with link count < 3..."; +system("find digest inode -type f -links -3 -print0 | xargs -0 rm -f") and die "system: exit status $?"; +print STDERR "\nRemoving empty directories..."; +system("find digest inode -type d -empty -print0 | xargs -0r rmdir -p --ignore-fail-on-non-empty") and die "system: exit status $?"; +print STDERR "\nDone.\n"; + exit(0); __END__ -- 2.30.2