Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Check if item is a folder

$
0
0

Hi,

Ihave an array like $a = gci and I am passing $a through a foreach statement.

How can I check if the item in the array is a folder, so like

if $item is not a folder then delete.  I tried this forst but its not working

remove-item $filepath -force | Where-Object { -not ($_.psiscontainer) }


Alter De Ruine


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>