File tree 2 files changed +57
-1
lines changed
2 files changed +57
-1
lines changed Original file line number Diff line number Diff line change
1
+ param (
2
+ [Parameter (Mandatory = $true )]
3
+ [string ]$jpgPath ,
4
+ [Parameter (Mandatory = $true )]
5
+ [string ]$rawPath ,
6
+ [switch ]$printConfig = $false
7
+ )
8
+
9
+ trap
10
+ {
11
+ write-output $_
12
+ exit 1
13
+ }
14
+
15
+ $rawFiles = " *.NEF"
16
+
17
+ echo " Starting..."
18
+ echo " jpg path: $jpgPath "
19
+ echo " raw path: $rawPath "
20
+
21
+ if ($printConfig )
22
+ {
23
+ exit
24
+ }
25
+
26
+ $jpgFiles = gci - Recurse - Path $jpgPath - include $jpgFiles
27
+ $rawFiles = gci - Recurse - Path $rawPath - include $rawFiles
28
+
29
+ $filesToRemove = @ ()
30
+
31
+ foreach ($rawFile in $rawFiles )
32
+ {
33
+ $filename = $rawFile.BaseName + " .JPG"
34
+ $jpgFile = join-path - Path $jpgPath - ChildPath $filename
35
+
36
+ write-host " Jpg path: $jpgFile "
37
+ if (! (Test-Path - Path $jpgFile ))
38
+ {
39
+ $filesToRemove += $rawFile.FullName
40
+ }
41
+ }
42
+
43
+ write-host " Going to remove:"
44
+ $filesToRemove | % { write-host $_ }
45
+ $r = read-host " Press 'y' to continue"
46
+
47
+ if ($r -eq " y" )
48
+ {
49
+ $filesToRemove | % { remove-item $_ }
50
+ }
51
+ else
52
+ {
53
+ write-host " Aborting"
54
+ }
55
+
56
+
57
+
Original file line number Diff line number Diff line change @@ -82,7 +82,6 @@ foreach ($item in $files)
82
82
$fullName = $item.FullName
83
83
$name = $item.Name
84
84
85
- Write-host " Extension: " $item.Extension.ToUpper ()
86
85
if ($item.Extension.ToUpper () -eq " .NEF" )
87
86
{
88
87
$destPath = join-path - Path $outdir - ChildPath " Raw"
You can’t perform that action at this time.
0 commit comments