-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeftvs.Right.ps1
More file actions
executable file
·77 lines (43 loc) · 1.62 KB
/
Leftvs.Right.ps1
File metadata and controls
executable file
·77 lines (43 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cls
$parentFolder = "C:\test"
$subFolder = Read-Host "Please Enter the Input Location"
$InputLocation = "$parentFolder\$subFolder"
Try
{
$LeftImages = gci -path $InputLocation -filter "*_L.tif" -ErrorAction Stop
$RightImages = gci -path $InputLocation -filter "*_R.tif" -ErrorAction stop
$WrongFiles = gci -path $InputLocation -Exclude "*.tif" -ErrorAction Stop
}#end try
Catch [System.Management.Automation.ItemNotFoundException]
{
Write-Host -Separator `n
Write-Host "Exception Type: $($_.Exception.GetType().FullName)" -ForegroundColor Green
Write-Host -Separator `n
Write-Host "Incorrect File Path, Please re-run the program with a correct file path"
}#end catch
Finally
{
Write-Host -Separator `n
Write-Host "End of Script Please re-run"
}#end of finally
$LeftDestination = "$InputLocation\LeftPages\"
$RightDestination = "$InputLocation\RightPages\"
foreach($file in $LeftImages){
if(!(Test-Path $LeftDestination)){
New-Item -ItemType directory -Path $LeftDestination
Move-Item $file.FullName -Destination $LeftDestination
}else{
Move-Item $file.FullName -Destination $LeftDestination
}
}
foreach($file in $RightImages){
if(!(Test-Path $RightDestination)){
New-Item -ItemType directory -Path $RightDestination
Move-Item $file.FullName -Destination $RightDestination
}else{
Move-Item $file.FullName -Destination $RightDestination
}
}
foreach($wrongfile in $WrongFiles){
Write-Host "File" $wrongfile.Name "is not a tif and will not work with this program"
}