Reputation: 3511
I am using Get-ChildItem
to iterate through a share path which have many folders and I am checking for a specific file in those folders and according to some checks related to date and time.
Problem: If any of the folder in the share path is not accessible then the Get-ChildItem
is failing and not progressing ahead.
Is there a way to silently continue to the next folder in case one of the folder is not accessible?
Upvotes: 0
Views: 78
Reputation: 230
you could use the -ErrorAction
switch
Get-ChildItem -Recurse -ErrorAction SilentlyContinue
Upvotes: 2