-
-
Save jreisinger/6499495 to your computer and use it in GitHub Desktop.
Add subtitles to Raymond
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use File::Basename; | |
my $movies = shift; | |
die "Usage: $0 '<movie_dir>'\n" unless $movies; | |
my @movies = glob "$movies/*.avi"; | |
@movies = map basename($_), @movies; # get just filenames | |
my $i = 0; | |
for my $old ( glob "*.srt" ) { | |
my $new = $movies[ $i++ ]; | |
$new =~ s/\.avi$/.srt/; | |
print "Renaming $old\n $new\n"; | |
rename $old, $new; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment