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 797bb9957956112a8ae19e1538261e3e3c436823
parent 7c5495f16540a563c0347b774d1dd6d762537c2e
Author: René Wagner <apollo@rw-net.de>
Date:   Tue,  1 Oct 2019 21:54:48 +0200

#0000030 use os agnostic dir delimiters

Diffstat:
Mjpegdivider.pl | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/jpegdivider.pl b/jpegdivider.pl @@ -8,12 +8,13 @@ use strict; use feature qw(say); use Cwd; use File::Basename; +use File::Copy; use File::Find; use File::Find::Rule; -use File::Copy; +use File::Spec::Functions; use Switch; -my $VERSION = '0.3'; +my $VERSION = '0.4'; my $PROGRAM = 'JpegDivider'; my $SUBFOLDER = 'JPEG'; @@ -46,7 +47,7 @@ sub main say "subfolder : $SUBFOLDER"; say ''; - my $destination_dir = "$dir\/$SUBFOLDER"; + my $destination_dir = catdir($dir, $SUBFOLDER); if ( $move_flag && ! -d $destination_dir ) { mkdir $destination_dir or die "Could not create destination dir $_ : $!"; @@ -60,15 +61,16 @@ sub main $move_counter++; if ( $move_flag ) { - if ( move($file, $destination_dir. '/' .basename($file) ) ) + if ( move($file, catfile($destination_dir, basename($file)) ) ) { - say "moved."; + print "moved."; } else { - say "move failed: $!"; + print "move failed: $!"; } } + say ''; } say "\r\nfound $move_counter jpeg files to subfolder.";