art-helpers

simple helper scripts for managing images processed by ART
git clone https://git.clttr.info/art-helpers.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit b4c9fc4f3b8944db14a69033b4e586a8be2bd92e
parent d452d3773fb23df79a7573dc26d379eb9713a0b4
Author: René Wagner <apollo@rw-net.de>
Date:   Mon, 30 Sep 2019 18:20:01 +0200

cosmetic cleanups

Diffstat:
Mmultiversion_sidecar_cleaner.pl | 18++++++------------
Morphaned_sidecar_cleaner.pl | 10+++-------
2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/multiversion_sidecar_cleaner.pl b/multiversion_sidecar_cleaner.pl @@ -11,7 +11,7 @@ use File::Find::Rule; use File::Find; use Switch; -my $VERSION = 0.1; +my $VERSION = '0.1'; my $PROGRAM = 'Multiversion Sidecar Cleaner'; my $delete_flag = 0; @@ -41,13 +41,10 @@ sub main print "files with newer versions:\r\n"; # alle Dateien in allen Unterordnern *.spd *.spf suchen - my $rule = File::Find::Rule->new; - $rule->file; - $rule->name( '*.spd', '*.spf' ); - my @files = $rule->in( $dir ); + + my @files = File::Find::Rule->file->name( '*.spd', '*.spf' )->in( $dir ); - my $file; - foreach $file ( @files ) + foreach my $file ( @files ) { if ( exist_newer_file($file) ) { @@ -88,12 +85,9 @@ sub exist_newer_file my $filefinder_regex = "$fileparts[0].$fileparts[1].$version_regex.$fileparts[3]"; - my $versions_rule = File::Find::Rule->new; - $versions_rule->file; - $versions_rule->name( $filefinder_regex ); - my @files = $versions_rule->in( dirname($original_file) ); + my @version_files = File::Find::Rule->file->name( $filefinder_regex )->maxdepth(1)->in( dirname($original_file) ); - if ( scalar @files ) + if ( scalar @version_files ) { return 1; } diff --git a/orphaned_sidecar_cleaner.pl b/orphaned_sidecar_cleaner.pl @@ -11,7 +11,7 @@ use File::Find::Rule; use File::Find; use Switch; -my $VERSION = 0.1; +my $VERSION = '0.1'; my $PROGRAM = 'Orphaned Sidecar Cleaner'; # parse commandline args @@ -43,13 +43,9 @@ sub main print "files with missing raw:\r\n"; # alle Dateien in allen Unterordnern *.spd *.spf suchen - my $rule = File::Find::Rule->new; - $rule->file; - $rule->name( '*.spd', '*.spf' ); - my @files = $rule->in( $dir ); + my @files = File::Find::Rule->file->name( '*.spd', '*.spf' )->in( $dir ); - my $file; - foreach $file ( @files ) + foreach my $file ( @files ) { if ( ! exists_raw_filename($file) ) {