Last active
August 29, 2015 14:15
-
-
Save parastuffs/5804db452f25cd2ee36a to your computer and use it in GitHub Desktop.
Rename batch
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/env perl | |
use strict; | |
use warnings; | |
use String::CRC32; | |
use File::Copy; | |
my (@files); | |
open(FD1, "ls *.mp4 *.mkv |"); | |
@files = <FD1>; | |
close(FD1); | |
foreach my $f (@files) { | |
chomp $f; | |
open(FD1, $f); | |
my $crc = crc32(*FD1); | |
close(FD1); | |
$crc = uc sprintf('%08x', $crc); | |
$f =~ m/.*\ ([\d][\d][\d]).*\.(.{3})$/g; | |
my $newname = "[VOSTFR]_Bleach_-_$1_[$crc].$2"; | |
print "$f is becoming $newname\n"; | |
rename("$f", "$newname"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment