Test-Path is a useful cmdlet for testing the validity of a path. You get a True/False return depending on if the path exists or not.
There’s also a way to add to the test by determining if the path points to a container (folder) or a leaf (file) using… Read the full text.