Skip to content

Instantly share code, notes, and snippets.

@jreisinger
Created September 9, 2013 18:22
Show Gist options
  • Save jreisinger/6499495 to your computer and use it in GitHub Desktop.
Save jreisinger/6499495 to your computer and use it in GitHub Desktop.
Add subtitles to Raymond
#!/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