diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-23 11:59:31 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-03-23 16:32:51 -0700 |
commit | 3f693e033d127930eade0fa1ac64fa753f283999 (patch) | |
tree | 6a64480e05377e063d3b58c65bdf6259a1974a81 /bin/locmaint | |
parent | b4091e4020dbac74f502d2b8a1f150918159a2a1 (diff) | |
download | dotfiles-3f693e033d127930eade0fa1ac64fa753f283999.tar.gz |
locmaint: permit zero-size .keep when checking whether dirs empty
Diffstat (limited to 'bin/locmaint')
-rwxr-xr-x | bin/locmaint | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/locmaint b/bin/locmaint index 67eea85b..c182ace0 100755 --- a/bin/locmaint +++ b/bin/locmaint @@ -593,13 +593,20 @@ Check whether C<$dir> contains any hidden or unhidden files, returning a true value if it does not, a false value if it does. If it does, print them. +As a special exception, ignore a zero-sized file named '.keep' (which +is used to prevent empty directories getting clobbered by things like +snap). + =cut sub empty_dir_or_list { my ($dir) = @_; opendir(my $dirh, $dir); - my @files = grep { $_ ne '.' && $_ ne '..' } readdir $dirh; + my @files + = grep $_ ne '.' + && $_ ne '..' + && !($_ eq ".keep" && -z catfile $dir, ".keep"), readdir $dirh; if (@files == 0) { return 1; |