Test-Path -exclude equivalent for remote path.

Advertisement

Guest

Test-Path -exclude equivalent for remote path.

I'm wondering if there is a powershell:
test-path c:\* -exclude test.txt
equivalent for remote folders?

I know I can find the existence of one file using:

$remotePath = "/home/user/test.txt"
 
if ($session.FileExists($remotePath))
{
    Write-Host ("File {0} exists" -f $remotePath)
}

but I want to find out if 1 specific file exists only - in a specific folder. (basically: if there is more then the specified file, return true; if it's just the one file, return false)

Thanks.

Reply with quote

Advertisement

You can post new topics in this forum