Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

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.