Re: Your idea on how to detect random directory names
[email protected] (ToddAndMargo via perl6-users)
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <[email protected]> |
On 12/8/23 23:41, Paul Procacci wrote: > > > On Sat, Dec 9, 2023 at 2:06 AM Bruce Gray <[email protected] > <mailto:[email protected]>> wrote: > > > > > On Dec 9, 2023, at 00:37, ToddAndMargo via perl6-users > <[email protected] <mailto:[email protected]>> 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 Hi Bruce and Paul, Thank you! -T