Created
July 26, 2016 20:01
-
-
Save Freezerburn/d9efbc524c927163e362ece5d7e9aaea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $filename = 'test.js'; | |
my $grep-filename = filename($filename).comb.map({ '.*' ~ do $^a eq '.' ?? '\\.' !! $^a }).join ~ '.*\\.' ~ $filename.IO.extension ~ '$'; | |
if not $grep-filename.starts-with('.*') { | |
$grep-filename = '.*' ~ $grep-filename; | |
} | |
$grep-filename.say; | |
my $grep-regex = /:i <$grep-filename>/; | |
# Paths are anonymized to just have magic variables in them. | |
my $src-path = "$SOURCE-PATH"; | |
my $dst-path = "$DEST-PATH"; | |
my @dir-stack = "$START-PATH".IO; | |
my @swap-list; | |
while @dir-stack.elems { | |
my $cur = pop @dir-stack; | |
for $cur.dir -> $next { | |
if $next.d { | |
push @dir-stack, $next; | |
} | |
elsif $next.basename ~~ $grep-regex { | |
push @swap-list, $next; | |
} | |
} | |
} | |
@swap-list.say; | |
#Will eventually look in dst for a file that matches files in swap-list and copy the source files over the dest ones. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment