commit 9e5250d5d23abd299ddeb55add573807dd1a3baf
parent e37021072dbde31274d7dcff0385984cb1703151
Author: René Wagner <apollo@rw-net.de>
Date: Sat, 28 Sep 2019 11:15:23 +0200
move check to function
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/orphaned_sidecar_cleaner.pl b/orphaned_sidecar_cleaner.pl
@@ -50,9 +50,7 @@ sub main
my $file;
foreach $file ( @files )
{
- my $rawfile = get_raw_filename($file);
-
- if ( ! -f $rawfile )
+ if ( ! exists_raw_filename($file) )
{
print $file .'...raw file not found!';
$delcounter++;
@@ -75,7 +73,11 @@ sub get_raw_filename
my ( $filename, $dirs ) = fileparse($original_file);
# Silkypix Sidecar files reside in a "SILKYPIX_DS" folder, so we need to search in the parent folder
$filename =~ s/\.\d+\.sp.$//g;
- return dirname($dirs) .'/'. $filename;
+ if ( -f dirname($dirs) .'/'. $filename )
+ {
+ return 1;
+ }
+ return 0;
}
sub show_help