Files
dojo/public/home/admin/event/listImages.pl
2018-07-18 04:28:26 -05:00

26 lines
515 B
Perl
Executable File

#!/usr/bin/perl
use warnings;
use strict;
use JSON;
use Cwd 'abs_path';
use lib abs_path("../../")."/sibelius2/conf";
use Paths;
#-------------------------
print getNames( Paths::MOD ."/cal/img");
sub getNames{
my $dir = shift;
my @file_name;
opendir(DIR, $dir) or die "error opening dir: $dir \n$!";
while (my $file = readdir(DIR)) {
next unless ( $file =~m/^[\w\d]/);
next unless (-f "$dir/$file");
push(@file_name,{name=>$file,tag=>"ilist"});
}
closedir(DIR);
return encode_json( \@file_name );
}
1;
__END__