vendredi 27 janvier 2017

Need OutPut of Get-ChildItem as Zero/One

We are using following code to check if there are any files created with the name "error" on a specific path. Following code return Name, Date attributes of file if found. Problem here is that we need not this text file/content as OutPut, rather we want If (File Found) > Return 1 Else > Return 0

Here is the code we are using: Get-ChildItem -Path D:\Temp*.txt | Where-Object {($.name -like "*error*") -and ($.Length -gt 0KB) -and ($_.LastWriteTime.Date -eq (Get-Date).Date)}

Can someone please help me get 0 or 1 as Output of this command.

Thanks in Anticipation.

Regards, Jawad YZ

Aucun commentaire:

Enregistrer un commentaire