On 12/8/23 23:41, Paul Procacci wrote:


On Sat, Dec 9, 2023 at 2:06 AM Bruce Gray <robertbrucegr...@gmail.com <mailto:robertbrucegr...@gmail.com>> wrote:



     > On Dec 9, 2023, at 00:37, ToddAndMargo via perl6-users
    <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
     >
     > Hi All,
     >
     > I am writing a clean up routine to relive my spot back ups
     > of junk in Blink browser directories that are meaningless to
     > a backup and that take up a lot of space.
     >
     > These directories are long and have random characters
     > for files names, such as "adcocjohghhfpidemphmcmlmhnfgikei"
     >
     > How who you go about figuring out who was random and
     > who was not.  I am thinking first the length and then
     > the absence of capitol letters and spaces and underscores.
     >
     > Your take?


    --snip--

    # Brave Browser temp directories: exactly 32 contiguous lowercase
    alpha characters.
    my $brave_junk_directories_re = / ^ <[a..z]> ** 32 $ /;
    my %to_skip = @filenames.grep($brave_junk_directories_re).Set;


I know this really wasn't mentioned clearly, but as a precaution you might also want to consider filtering on whether the inode is referencing a file or not:

my @to_skip = dir(".", test => { .IO.d && / ^ <[a..z]> ** 32 $ / } ) ;

If that possibility doesn't exist, then I personally would use:

my @to_skip = dir(".", test => { / ^ <[a..z]> ** 32 $ / } ) ;

As always, there's more than one way to skin a cat.

~Paul

I was thinking of something silly, such as first checking that
the length was 32 bits and then comparing the name against the
name in lower case:

$ raku
...
[0] > my $x="abcde"; my $y="aBcde"

[1] > say $x eq $x.lc
True

[1] > say $y eq $y.lc
False


Reply via email to