SQLiteデータベースファイルを開くと、ファイルの先頭に読み取り可能なテキストがたくさんあります--B
ファイルテストのためにSQLiteファイルが誤ってフィルタリングされる可能性はどのくらいありますか?
#!/usr/bin/env perl
use warnings;
use strict;
use 5.10.1;
use File::Find;
my $dir = shift;
my $databases;
find( {
wanted => sub {
my $file = $File::Find::name;
return if not -B $file;
return if not -s $file;
return if not -r $file;
say $file;
open my $fh, '<', $file or die "$file: $!";
my $firstline = readline( $fh ) // '';
close $fh or die $!;
push @$databases, $file if $firstline =~ /\ASQLite\sformat/;
},
no_chdir => 1,
},
$dir );
say scalar @$databases;