Assert-FileDoesNotExist

Asserts that a file does not exist.

Syntax

Assert-FileDoesNotExist [[-Path] <String>] [[-Message] <String>] [<CommonParameters>]

Description

Uses PowerShell's Test-Path cmdlet to check if a file doesn't exist.

Parameters

Name Type Description Required? Pipeline Input Default Value
Path String

The path to the file to check.

false false
Message String

A description of why the assertion might fail.

false false

EXAMPLE 1

Assert-FileDoesNotExist 'C:\foobar.txt'

Demonstrates how to assert that a does not exist.

EXAMPLE 2

Assert-FileDoesNotExist 'C:\foobar.txt' 'foobar.txt not removed.'

Demonstrates how to describe why an assertion might fail.