rawfilewizard

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.clttr.info/rawfilewizard.git
Log | Files | Refs | README | LICENSE

commit 5bcdf4bc9052645672f7e9f62d8555340e29d282
parent 6590a3cd199359dde68fdaa917fdbd96328f32e4
Author: rwa <apollo@rw-net.de>
Date:   Sat, 28 Sep 2019 11:18:59 +0000

Deleted scripts/README.md, scripts/orphaned_sidecar_cleaner.pl, scripts files
Diffstat:
Dscripts/README.md | 17-----------------
Dscripts/orphaned_sidecar_cleaner.pl | 94-------------------------------------------------------------------------------
2 files changed, 0 insertions(+), 111 deletions(-)

diff --git a/scripts/README.md b/scripts/README.md @@ -1,16 +0,0 @@ -# Silkypix Helper Scripts -This rather small scripts written in [Perl](https://perl.org) provide useful function for managing the sidecar data files created by [Silkypix Developer Studio](https://silkypix.isl.co.jp/en/). - -## required perl modules -The following perl modules are required for running the scripts. -- Cwd -- File::Spec -- File::Basename -- File::Find::Rule -- File::Find -- Switch - -## description - -## orphaned sidecar cleaner -Deletes all sidecar files in the given directory or alternatively in the current working directory when the associated raw file is missing. -\ No newline at end of file diff --git a/scripts/orphaned_sidecar_cleaner.pl b/scripts/orphaned_sidecar_cleaner.pl @@ -1,93 +0,0 @@ -#!/usr/bin/perl - -use warnings; -use strict; -use Cwd; -use File::Spec; -use File::Basename; -use File::Find::Rule; -use File::Find; -use Switch; - -my $VERSION = 0.1; -my $PROGRAM = 'Orphaned Sidecar Cleaner'; - -# parse commandline args -# last dir will win -my $delete_flag = 0; -my $delete_dir = getcwd; - -foreach my $arg ( @ARGV ) -{ - switch ( $arg ) - { - case '-h' { show_help(); exit; } - case '-d' { $delete_flag = 1; } - else { if ( -d $arg ) { $delete_dir = $arg } } - } -} - -print "working directory: $delete_dir \r\n"; - -main($delete_dir, $delete_flag); - -exit 0; - -sub main -{ - my ( $dir, $delete ) = @_; - my ( $delcounter ) = 0; - - # 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 $file; - foreach $file ( @files ) - { - my $rawfile = get_raw_filename($file); - - if ( ! -f $rawfile ) - { - print $file .'...raw file not found!'; - $delcounter++; - if ( $delete ) - { - print " Deleting"; - unlink $file or warn " failed: $!"; - } - print "\r\n"; - } - } - - print "Found $delcounter orphaned sidecar files found.\r\n"; -} - -sub get_raw_filename -{ - my ( $original_file ) = @_; - - my ( $filename, $dirs ) = fileparse($original_file); - # Silkypix Sidecar files reside in a "SILKYPIX_DS" folder, so we need to search in the parent folder - $filename =~ s/\.\d+\.sp.$//g; - return dirname($dirs) .'/'. $filename; -} - -sub show_help -{ - print $PROGRAM . ' - version ' . $VERSION . "\r\n"; - print "published under BSD 3 - Clause License \r\n"; - print "Copyright(c) 2018-2019, René Wagner\r\n"; - print "https://gitlab.com/guzzisti1/rawfilewizard \r\n"; - print "\r\n"; - print "Deletes Silkypix Sidecar files when corresponding RAW files are missing.\r\n"; - print "\r\n"; - print "commandline parameters:\r\n"; - print "orphaned_sidecar_cleaner.pl - list orphaned sidecar file in current working directory and subfolders\r\n"; - print "orphaned_sidecar_cleaner.pl -d - delete orphaned sidecar file in current working directory and subfolders\r\n"; - print "orphaned_sidecar_cleaner.pl <folder> - list orphaned sidecar file in given directory and subfolders\r\n"; - print "orphaned_sidecar_cleaner.pl -d <folder> - delete orphaned sidecar file in given directory and subfolders\r\n"; - print "orphaned_sidecar_cleaner.pl -h - show this help\r\n"; -} -\ No newline at end of file