Skip to content

Commit 6ce96d0

Browse files
author
Daniel Sundberg
committed
Added script to clean raw files from directory when given cleaned up jpg dir
1 parent 21c8040 commit 6ce96d0

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

clean-raw.ps1

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+

copy-images.ps1

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ foreach ($item in $files)
8282
$fullName = $item.FullName
8383
$name = $item.Name
8484

85-
Write-host "Extension: " $item.Extension.ToUpper()
8685
if ($item.Extension.ToUpper() -eq ".NEF")
8786
{
8887
$destPath = join-path -Path $outdir -ChildPath "Raw"

0 commit comments

Comments
 (0)