a8e95b33c4963803781d1dd8f044312f049085e6
commit a8e95b33c4963803781d1dd8f044312f049085e6
Author: spesk1 <spesk@pm.me>
Date: Mon Jul 29 16:55:51 2019 -0400

Try to handle glob cases better

diff --git a/strip_filename.pl b/strip_filename.pl
index 17ec7ae..f2f7c47 100755
--- a/strip_filename.pl
+++ b/strip_filename.pl
@@ -26,12 +26,31 @@ sub strip_filename($) {
return $new_filename;
}

+sub construct_mv_fn($) {
+
+ my $filename = shift;
+ my @chars = split("",$filename);
+ my $new_filename;
+ open(my $fh, ">>", \$new_filename) or die "Couldn't open new_filename var\n";
+ foreach my $char ( @chars ) {
+ if ( $char eq " " ) {
+ print $fh "\\$char";
+ } else {
+ print $fh $char;
+ }
+ }
+ close $fh;
+ return $new_filename;
+
+}
+
sub rename_file($$) {

my ( $old_filename, $new_filename ) = @_;
- my $cmd = "mv '$old_filename' $new_filename";
+ my $mv_filename = construct_mv_fn($old_filename);
+ my $cmd = "mv '$mv_filename' $new_filename";
print "$cmd\n";
- system("$cmd");
+ #system("$cmd");

}