commit c8ae4b77ffc5f827910c23a951de1881c7f5d4c4
parent 348b33cd004a3a36b43fa8202aed65c68bcdaeb9
Author: René Wagner <rwagner@rw-net.de>
Date: Tue, 12 May 2020 20:45:20 +0200
~rwa/photo-workflow#1: allow to safe setting with -s switch
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/art_file_mover.pl b/art_file_mover.pl
@@ -17,7 +17,7 @@ use Getopt::Std;
$Getopt::Std::STANDARD_HELP_VERSION = 'true';
-my $VERSION = '0.41';
+my $VERSION = '0.5';
my $PROGRAM = 'Art File Mover';
my $configfile = catfile(File::HomeDir->my_home, '.art_file_mover.conf');
@@ -56,6 +56,9 @@ sub move_files
my $move_counter = 0;
say "destination dir : $destination_dir";
+ say "raw file ext : $opt_r";
+ say "output file dir : $opt_f";
+ say "output file ext : $opt_c";
say 'action : '. ($opt_l ? 'list only' : 'move');
say '';
my $converted_destination_dir = catfile($destination_dir, $opt_f);
@@ -92,8 +95,7 @@ sub move_files
move($rawarp_file, catfile($destination_dir, basename($rawarp_file)));
if ( move($converted_file, catfile($converted_destination_dir, basename($converted_file))) &&
- move($raw_file, catfile($destination_dir, basename($raw_file)))
- )
+ move($raw_file, catfile($destination_dir, basename($raw_file))) )
{
print 'moved.';
}
@@ -111,11 +113,17 @@ sub move_files
sub getconfig
{
my ( $config_filename ) = @_;
+ if ( -f $config_filename ) { do $config_filename; }
}
sub writeconfig
{
my ( $config_filename ) = @_;
+ open(my $filehandle, '>', $config_filename) or die "Could not open file '$config_filename': $!";
+ say $filehandle '$opt_f="'. $opt_f .'";';
+ say $filehandle '$opt_c="'. $opt_c .'";';
+ say $filehandle '$opt_r="'. $opt_r .'";';
+ close $filehandle;
}
sub main::VERSION_MESSAGE()