Skip to content

Commit bd40e48

Browse files
committed
Rename .aws to .pscp.
Modify implementation of Get-Root to use Test-Path. Variable name changes
1 parent 3ecf2c4 commit bd40e48

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

Copy-AWS.psm1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Copy-AWS
2727
{
2828
$aws_info=Get-Content -Path "$root\aws_info.txt"|ConvertFrom-StringData
2929
$keypath= "$root\$($aws_info.keyfile)"
30-
$host=$aws_info.dns
30+
$host=$aws_info.host
3131
}
3232

3333

@@ -107,25 +107,25 @@ http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter5.html
107107
}
108108

109109

110-
function Get-Root([string] $path)
110+
function Get-Root([string] $CurrentPath, [string]$FolderName)
111111
{
112-
Write-Verbose $path
112+
Write-Verbose $CurrentPath
113113

114-
if(Get-ChildItem $path\*.aws)
114+
if(Test-Path $CurrentPath\$FolderName)
115115
{
116-
return "$path\.aws"
116+
return "$CurrentPath\$FolderName"
117117
}
118118

119-
$root=[System.IO.Directory]::GetDirectoryRoot($path)
120-
if($path -eq $root)
119+
$driveRoot=[System.IO.Directory]::GetDirectoryRoot($CurrentPath)
120+
if($CurrentPath -eq $driveRoot)
121121
{
122-
Write-Host "Path name: $path is equal to root name: $root"
123-
Write-Host "root path .aws not found."
122+
Write-Host "Path: $CurrentPath is the drive root: $driveRoot"
123+
Write-Host "root path .pscp not found."
124124
return
125125
}
126126

127-
$path=([System.IO.Directory]::GetParent(($path))).FullName
128-
Get-Root $path
127+
$CurrentPath=([System.IO.Directory]::GetParent(($CurrentPath))).FullName
128+
Get-Root $CurrentPath $FolderName
129129

130130
}
131131

Example/.aws/aws_info.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

Example/.pscp/aws_info.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
keyfile=my_key_pair.ppk
2+
host=ec2-00-00-00-00.us-west-2.compute.amazonaws.com

0 commit comments

Comments
 (0)