commit 2d0157f50cea2b05cc1e4d5fa20eaf74ae65c765
parent 16b4dfaaf952767e94a58bf35da168bc56c37282
Author: René Wagner <rwagner@rw-net.de>
Date: Sun, 22 Mar 2020 19:51:23 +0100
art_file_mover: check destination dir, update help
Diffstat:
4 files changed, 24 insertions(+), 34 deletions(-)
diff --git a/art_file_mover.pl b/art_file_mover.pl
@@ -8,7 +8,7 @@ use strict;
use feature qw(say);
use Cwd;
use File::Basename;
-use File::Copy;
+#use File::Copy;
use File::Find;
use File::Find::Rule;
use File::Spec::Functions;
@@ -16,7 +16,7 @@ use Getopt::Std;
$Getopt::Std::STANDARD_HELP_VERSION = 'true';
-my $VERSION = '0.1';
+my $VERSION = '0.2';
my $PROGRAM = 'Art File Mover';
# read commandline switches
@@ -24,20 +24,18 @@ our $opt_m = 0;
our $opt_r = 'DNG';
our $opt_f = 'JPEG';
-if ( !getopts('mr:f:') )
-{
- die("Invalid parameters provided! See 'art_file_mover.pl --help' for more details.");
-}
+getopts('mr:f:') or die "Invalid parameters provided! See 'art_file_mover.pl --help' for more details.";
-# read remaining commandline args
+# read remaining commandline args für destination dir
# last dir will win
-# TODO: handle if destination dir is current dir or empty
my $destination_dir = getcwd;
foreach my $arg ( @ARGV )
{
$destination_dir = $arg;
}
+(getcwd ne $destination_dir) or die "target directory is currenty directory!";
+
move_files($destination_dir);
exit 0;
@@ -78,9 +76,9 @@ 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))) &&
- move($raw_file, catfile($destination_dir, basename($raw_file))) &&
- move($rawarp_file, catfile($destination_dir, basename($rawarp_file)))
+ move($outarp_file, catfile($destination_dir, $opt_f, basename($outarp_file))) &&
+ move($raw_file, catfile($destination_dir, basename($raw_file))) &&
+ move($rawarp_file, catfile($destination_dir, basename($rawarp_file)))
)
{
print 'moved.';
@@ -109,8 +107,10 @@ sub main::HELP_MESSAGE
say '';
say 'Find all by ART converted files in the current folder and their corresponding RAWs and move them to specified directory';
say '';
- say 'commandline parameters:';
- say 'art_file_mover.pl <folder> - list all found files in the given directory that will eventually be moved';
- say 'art_file_mover.pl -m <folder> - move all converted files and their raws';
+ say 'commandline parameters - should be combined to match your needs:';
+ say 'art_file_mover.pl <folder> - list all found files in the current working directory that will eventually be moved';
+ say 'art_file_mover.pl -m <folder> - move all converted files and their raws to the given folder';
+ say 'art_file_mover.pl -r <rawextension> - override the raw extensions , defaults to "DNG"';
+ say 'art_file_mover.pl -f <folder> - override the folder for converted JPEGs, defaults to "JPEG"';
say 'art_file_mover.pl --help - show this help';
}
diff --git a/jpegdivider.pl b/jpegdivider.pl
@@ -23,10 +23,7 @@ my $PROGRAM = 'JpegDivider';
our $opt_m = 0;
our $opt_f = 'JPEG';
-if ( !getopts('mf:') )
-{
- die("Invalid parameters provided! See 'jpegdivider.pl --help' for more details.");
-}
+getopts('mf:') or die "Invalid parameters provided! See 'jpegdivider.pl --help' for more details.";
# read remaining commandline args
# last dir will win
@@ -92,10 +89,10 @@ sub main::HELP_MESSAGE
say '';
say 'Moves JPEG files to a designated subfolder, by default "JPEG"';
say '';
- say 'commandline parameters:';
+ say 'commandline parameters - should be combined to match your needs:';
say 'jpegdivider.pl - list all jpeg files in the current working dir';
say 'jpegdivider.pl -m - create a subfolder "JPEG" in the current working dir and move jpeg files in there';
- say 'jpegdivider.pl <folder> - list all jpeg files in the given directory';
- say 'jpegdivider.pl -m <folder> - create a subfolder "JPEG" in the given directory and move jpeg files in there';
+ say 'jpegdivider.pl -f <subfolder> - use the given subfolder instead of "JPEG"';
+ say 'jpegdivider.pl <folder> - list/move all jpeg files in the given directory';
say 'jpegdivider.pl --help - show this help';
}
diff --git a/silkypix_multiversion_sidecar_cleaner.pl b/silkypix_multiversion_sidecar_cleaner.pl
@@ -20,10 +20,7 @@ my $PROGRAM = 'Multiversion Sidecar Cleaner';
# read commandline switches
our $opt_d = 0;
-if ( !getopts('d') )
-{
- die("Invalid parameters provided! See 'silkypix_multiversion_sidecar_cleaner.pl --help' for more details.");
-}
+getopts('d') or die "Invalid parameters provided! See 'silkypix_multiversion_sidecar_cleaner.pl --help' for more details.";
# read remaining commandline args
# last dir will win
@@ -116,10 +113,9 @@ sub main::HELP_MESSAGE
say 'Deletes Silkypix Sidecar files when newer versions of the files are available.';
say 'This usually happens when a file is opened in a newer version of Silkypix, as the sidecar files are version specific.';
say '';
- say 'commandline parameters:';
+ say 'commandline parameters - should be combined to match your needs:';
say 'duplicate_sidecar_cleaner.pl - list duplicate sidecar file versions in current working directory and subfolders';
say 'duplicate_sidecar_cleaner.pl -d - delete duplicate sidecar file versions in given directory and subfolders';
- say 'duplicate_sidecar_cleaner.pl <folder> - list duplicate sidecar file versions in given directory and subfolders';
- say 'duplicate_sidecar_cleaner.pl -d <folder> - delete duplicate sidecar file versions in given directory and subfolders';
+ say 'duplicate_sidecar_cleaner.pl <folder> - list/delete duplicate sidecar file versions in given directory and subfolders';
say 'duplicate_sidecar_cleaner.pl --help - show this help';
}
diff --git a/silkypix_orphaned_sidecar_cleaner.pl b/silkypix_orphaned_sidecar_cleaner.pl
@@ -21,9 +21,7 @@ my $PROGRAM = 'Orphaned Sidecar Cleaner';
# read commandline switches
our $opt_d = 0;
-if ( !getopts('d') )
-{
- die("Invalid parameters provided! See 'silkypix_multiversion_sidecar_cleaner.pl --help' for more details.");
+getopts('d') or die "Invalid parameters provided! See 'silkypix_multiversion_sidecar_cleaner.pl --help' for more details.";
}
# read remaining commandline args
@@ -101,10 +99,9 @@ sub main::HELP_MESSAGE
say '';
say 'Deletes Silkypix Sidecar files when corresponding RAW files are missing.';
say '';
- say 'commandline parameters:';
+ say 'commandline parameters - should be combined to match your needs:';
say 'orphaned_sidecar_cleaner.pl - list orphaned sidecar file in current working directory and subfolders';
say 'orphaned_sidecar_cleaner.pl -d - delete orphaned sidecar file in current working directory and subfolders';
- say 'orphaned_sidecar_cleaner.pl <folder> - list orphaned sidecar file in given directory and subfolders';
- say 'orphaned_sidecar_cleaner.pl -d <folder> - delete orphaned sidecar file in given directory and subfolders';
+ say 'orphaned_sidecar_cleaner.pl <folder> - list/delete orphaned sidecar file in given directory and subfolders';
say 'orphaned_sidecar_cleaner.pl --help - show this help';
}