in reply to WMA / WMV files

Working, tested code:
#!/usr/bin/perl -w use strict; use File::Find; use File::Copy; # WMA/WMV file signature; See: # http://filext.com/detaillist.php?extdetail=WMA # http://filext.com/detaillist.php?extdetail=WMV my $sig = "\x30\x26\xB2\x75\x8E\x66\xCF\x11" . "\xA6\xD9\x00\xAA\x00\x62\xCE\x6C"; my @drives = map {$_.':/'} qw( c e ); # Work-around for Win32 bug in File::Find. chdir $_ foreach @drives; my @fakes; find( sub { # Skip known NTFS-locked directories. $File::Find::prune = 1, return if /^System Volume Information$/; return unless m{\.wm[av]$}i and -f $_; open IN, $_ or return; binmode IN; read(IN, my $f16, 16); close IN; push @fakes, $File::Find::name if $f16 ne $sig; }, @drives ); foreach (@fakes) { print "Fake: $_\n"; move($_, "$_-fake") or warn "Rename failed: '$_'\n"; }

Replies are listed 'Best First'.
Re: Re: WMA / WMV files
by Anonymous Monk on Mar 27, 2004 at 02:51 UTC
    Oops, I was not signed on when I posted that!