I am using a powershell script to list files over x minutes old
get-childitem -Path "C:\test" -recurse | where-object {$_.LastWriteTime -le (get-date).AddMinutes(-1)}
What this does is return the following
Directory: C:\test
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 31/10/2012 02:44 0 1.txt
I understand that adding > output.txt will write this to a file
What I need is to write out to a file 1 if it finds any files and 0 if it return no files.
Does anyone know how to do this?
get-childitem -Path "C:\test" -recurse | where-object {$_.LastWriteTime -le (get-date).AddMinutes(-1)}
What this does is return the following
Directory: C:\test
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 31/10/2012 02:44 0 1.txt
I understand that adding > output.txt will write this to a file
What I need is to write out to a file 1 if it finds any files and 0 if it return no files.
Does anyone know how to do this?