# Question:

I’ve written a script that will be used for archiving log files from a server. I’m in pretty good shape with everything but the recursiveness or not of Get-ChildItem

The issue I seem to be having is that when Get-ChildItem is not recursive and `-Include` is present with only one filter, it is ignored! Or, I’m doing something wrong (likely).

I’ve cleaned up the output a little…

Sooo??? I had a fantasy where all I had to do was branch to a path of the script that did not have the recurse switch. (By the way, is it possible to variably apply parameters so as to avoid duplicated code paths where the only variability is the parameters to a cmdlet?)

Anyway, here is my script for completeness, in addition to my issue with Get-ChildItem.

The answer is in the full description of the command (get-help get-childitem -full):

The Include parameter is effective
only when the command includes the
Recurse parameter or the path leads to
the contents of a directory, such as
C:\Windows\*, where the wildcard
character specifies the contents of
the C:\Windows directory.

So the following would work without recurse.