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 250fdb50171fd0aa52c8f7020e153e79d159bd75
parent a682de13538a9f6e8afbdf1b50e6ec315564d334
Author: René Wagner <rwagner@rw-net.de>
Date:   Fri, 24 Apr 2020 21:33:03 +0200

art_file_mover: fix when destination dir already exists but jpeg destination dir not

Diffstat:
Mart_file_mover.pl | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/art_file_mover.pl b/art_file_mover.pl @@ -16,7 +16,7 @@ use Getopt::Std; $Getopt::Std::STANDARD_HELP_VERSION = 'true'; -my $VERSION = '0.2'; +my $VERSION = '0.3'; my $PROGRAM = 'Art File Mover'; # read commandline switches @@ -48,11 +48,12 @@ sub move_files say "destination dir : $destination_dir"; say 'action : '. ($opt_m ? 'move' : 'list only'); say ''; - - if ( $opt_m && (! -d $destination_dir || ! -d catfile($destination_dir, $opt_f))) + my $jpeg_destination_dir = catfile($destination_dir, $opt_f); + + if ( $opt_m && (! -d $destination_dir || ! -d $jpeg_destination_dir)) { - mkdir $destination_dir or die "Could not create destination dir $_ : $!"; - mkdir catfile($destination_dir, $opt_f) or die "Could not create destination dir $_ : $!"; + if (! -d $destination_dir ) { mkdir $destination_dir or die "Could not create destination dir $_ : $!"; } + if (! -d $jpeg_destination_dir ) { mkdir $jpeg_destination_dir or die "Could not create destination dir $_ : $!"; } } # find all jpegs in current dir @@ -75,8 +76,8 @@ sub move_files } elsif ( $opt_m ) { - if ( move($jpeg_file, catfile($destination_dir, $opt_f, basename($jpeg_file))) && - move($outarp_file, catfile($destination_dir, $opt_f, basename($outarp_file))) && + if ( move($jpeg_file, catfile($jpeg_destination_dir, basename($jpeg_file))) && + move($outarp_file, catfile($jpeg_destination_dir, basename($outarp_file))) && move($raw_file, catfile($destination_dir, basename($raw_file))) && move($rawarp_file, catfile($destination_dir, basename($rawarp_file))) )