I have a statement in my power shell script that archives all files in a directory to a given path:
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourcePath,$destPath, $compressionLevel, $false);
What I want to is to instead of archiving whole directory just archive items that I selected through this statement:
Get-ChildItem $sourcePath -include *.txt,*.log | Where-Object { $_.CreationTime -le $archiveTillDate }
So how is it possible to pass a specific set of files as a parameter to CreateFromDirectory
instead of path to whole directory?