Skip to content

Commit

Permalink
beet-cleanup-cover-only-directories: use move instead of rm
Browse files Browse the repository at this point in the history
  • Loading branch information
trapd00r committed Mar 29, 2023
1 parent a191271 commit 30c707d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions beet-cleanup-cover-only-directories
Expand Up @@ -14,6 +14,8 @@ use File::LsColor qw(ls_color);

my $start_path = shift // '.';
my $max_size = 2 * 1024 * 1024; # 2 MB
my $tmpdir = './dirs_with_only_cover_in_them_or_less_than_2M';
system("mkdir -vp $tmpdir");

my $logfile = 'dirs_with_only_cover_in_them_or_less_than_2M.log';

Expand All @@ -32,7 +34,8 @@ sub check_dir {
if (@files == 1 && $files[0] eq "cover.jpg") {
my $abspath = abs_path($dir);
print sprintf("only cover.jpg: %s\n", ls_color($abspath));
print $fh sprintf("rm -r @{[ quotemeta($abspath) ]}\n");
# print $fh sprintf("rm -r @{[ quotemeta($abspath) ]}\n");
print $fh sprintf("mv @{[ quotemeta($abspath) ]} -t $tmpdir\n");
return;
}

Expand All @@ -47,7 +50,8 @@ sub check_dir {
my $abspath = abs_path($dir);

print sprintf("< 2M %s\n", ls_color($abspath));
print $fh sprintf("rm -r @{[ quotemeta($abspath) ]}\n");
# print $fh sprintf("rm -r @{[ quotemeta($abspath) ]}\n");
print $fh sprintf("mv @{[ quotemeta($abspath) ]} -t $tmpdir\n");
}
}

Expand Down

0 comments on commit 30c707d

Please sign in to comment.