Browse code

Deleted scripts/README.md, scripts/orphaned_sidecar_cleaner.pl, scripts files

rwa authored on 28.09.2019 13:18:59
Showing 2 changed files

1 1
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
1
-# Silkypix Helper Scripts
2
-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/).
3
-
4
-## required perl modules
5
-The following perl modules are required for running the scripts.
6
-- Cwd
7
-- File::Spec
8
-- File::Basename
9
-- File::Find::Rule
10
-- File::Find
11
-- Switch
12
-
13
-## description
14
-
15
-## orphaned sidecar cleaner
16
-Deletes all sidecar files in the given directory or alternatively in the current working directory when the associated raw file is missing.
17 0
\ No newline at end of file
18 1
deleted file mode 100644
... ...
@@ -1,93 +0,0 @@
1
-#!/usr/bin/perl
2
-
3
-use warnings;
4
-use strict;
5
-use Cwd;
6
-use File::Spec;
7
-use File::Basename;
8
-use File::Find::Rule;
9
-use File::Find;
10
-use Switch;
11
-
12
-my $VERSION = 0.1;
13
-my $PROGRAM = 'Orphaned Sidecar Cleaner';
14
-
15
-# parse commandline args
16
-# last dir will win
17
-my $delete_flag = 0;
18
-my $delete_dir = getcwd;
19
-
20
-foreach my $arg ( @ARGV ) 
21
-{
22
-	switch ( $arg )
23
-	{
24
-		case '-h'   { show_help(); exit; }
25
-	 	case '-d'	{ $delete_flag = 1; }
26
-	 	else		{ if ( -d $arg ) { $delete_dir = $arg } }
27
-	}
28
-}
29
-
30
-print "working directory: $delete_dir \r\n";
31
-
32
-main($delete_dir, $delete_flag);
33
-
34
-exit 0;
35
-
36
-sub main
37
-{
38
-	my ( $dir, $delete ) = @_;
39
-	my ( $delcounter ) = 0;
40
-
41
-	# alle Dateien in allen Unterordnern *.spd *.spf suchen
42
-	my $rule =  File::Find::Rule->new;
43
-	$rule->file;
44
-	$rule->name( '*.spd', '*.spf' );
45
-	my @files = $rule->in( $dir );
46
-	
47
-	my $file;
48
-	foreach $file ( @files )
49
-	{
50
-		my $rawfile = get_raw_filename($file);
51
-		
52
-		if ( ! -f $rawfile )
53
-		{
54
-			print $file .'...raw file not found!';
55
-			$delcounter++;
56
-			if ( $delete )
57
-			{
58
-				print " Deleting";
59
-				unlink $file or warn " failed: $!";
60
-			}	
61
-			print "\r\n";
62
-		}
63
-	}
64
-	
65
-	print "Found $delcounter orphaned sidecar files found.\r\n";
66
-}
67
-
68
-sub get_raw_filename
69
-{
70
-	my ( $original_file ) = @_;
71
-	
72
-	my ( $filename, $dirs ) = fileparse($original_file);
73
-	# Silkypix Sidecar files reside in a "SILKYPIX_DS" folder, so we need to search in the parent folder
74
-	$filename =~ s/\.\d+\.sp.$//g;
75
-	return dirname($dirs) .'/'. $filename;
76
-}
77
-
78
-sub show_help
79
-{
80
-	print $PROGRAM . ' - version ' . $VERSION . "\r\n";
81
-	print "published under BSD 3 - Clause License \r\n";
82
-	print "Copyright(c) 2018-2019, René Wagner\r\n";
83
-	print "https://gitlab.com/guzzisti1/rawfilewizard \r\n";
84
-	print "\r\n";
85
-	print "Deletes Silkypix Sidecar files when corresponding RAW files are missing.\r\n";
86
-	print "\r\n";
87
-	print "commandline parameters:\r\n";
88
-	print "orphaned_sidecar_cleaner.pl - list orphaned sidecar file in current working directory and subfolders\r\n";
89
-	print "orphaned_sidecar_cleaner.pl -d - delete orphaned sidecar file in current working directory and subfolders\r\n";	
90
-	print "orphaned_sidecar_cleaner.pl <folder> - list orphaned sidecar file in given directory and subfolders\r\n";
91
-	print "orphaned_sidecar_cleaner.pl -d <folder> - delete orphaned sidecar file in given directory and subfolders\r\n";
92
-	print "orphaned_sidecar_cleaner.pl -h - show this help\r\n";
93
-}
94 0
\ No newline at end of file