From 5e90496cad15fcbb5a25563392db5d9f657b9598 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Tue, 19 Feb 2008 11:26:09 +1300 Subject: [PATCH] Making picture-upload.pl case insensitive when looking for DATALINK.TXT or IDLINK.TXT Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- tools/picture-upload.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl index 598ee26fd3..f38e462055 100755 --- a/tools/picture-upload.pl +++ b/tools/picture-upload.pl @@ -88,9 +88,13 @@ output_html_with_http_headers $input, $cookie, $template->output; sub handle_dir { my ( $dir ) = @_; my ( %count ); + my $file; $count{filenames} = (); - - my $file = ( -r "$dir/IDLINK.TXT" ) ? "$dir/IDLINK.TXT" : "$dir/DATALINK.TXT"; + + opendir my $dirhandle, $dir; + while ( my $filename = readdir $dirhandle ) { + $file = "$dir/$filename" if ($filename =~ qr/datalink\.txt/i || qr/idlink\.txt/i); + } unless (open (FILE, $file)) { print "Openning $dir/$file failed!\n"; return 0; -- 2.39.2