What I have so far:

#!/usr/bin/env perl6

#`{
Clean up the useless to a back up directories in Brave Browser

$ ls ~/.config/BraveSoftware/Brave-Browser
 adcocjohghhfpidemphmcmlmhnfgikei   GrShaderCache
...
}

use lib '/home/linuxutil/p6lib';
use RunNoShellLib :RunNoShell;
use PrintColors :PrintRed, :PrintGreen, :PrintBlue, :PrintErr, :PrintRedErr, :PrintGreenErr, :PrintBlueErr;


( my $ProgramName   = $?FILE ) ~~ s|.*"/"||;
my Str $BaveDir     = %*ENV<HOME> ~ "/.config/BraveSoftware/Brave-Browser";
my Str $DirsToWhack = "";

for dir $BaveDir -> $Line  {
   # print $Line ~ "\n";
   if  $Line.chars != 79 || $Line.contains( "_" || "-" || " " )  {
      # print "Skip; chars = <" ~ $Line.chars ~ ">  Line = <$Line>\n";
      next;
   }

   # print $Line ~ "\n";
   ( my $DirName  = $Line ) ~~ s/ .* $( Q[/] ) //;
   if  $DirName.lc eq $DirName {
        $DirsToWhack ~= $Line ~ "\n";
        # print $DirName ~ "\n";
   }
}
# print "Whack directories\n$DirsToWhack\n";

if $DirsToWhack.chars > 0  {
   for $DirsToWhack.lines -> $Line  {
      # PrintBlue "removing <$Line>\n";
      PrintBlue "rm -rf $Line\n";
      RunNoShell "rm -rf $Line";
   }

} else {
   PrintGreen "No directories found to clean out (Whack)\n";
}

# With that, I shall "Whack" no more

Reply via email to