I have a Folder that will have a few dozen Folders in it that will have content added to them on a regular basis. When that folder is ready for production it will have a .submit file added to it. Once that file is added, I need to zip the contents into one zip file.
Folder A
Folder 1
Folder 2
Folder 3
content1
content2
content.submit
------------------------
should become
------------------------
Folder A
Folder 1
Folder 2
Folder 3
folder3.zip(containing content1, content2, content.submit)
I hope that makes sense. So far, I can get it to find the folders that contain the .submit, but when it zips, it only zips the .submit, not the content of the folder. I am using a 7zip call, but am perfectly willing to use write-zip or any other zip method. I am just having a tough time getting the whole directory added to the zip.
$PathToZipper="C:\Program Files\7-Zip"
Get-ChildItem "C:\users\XXXXX\Desktop\XXXXXXXXX" -Recurse -Filter "*.submit" |foreach{
$PathToFile=Split-Path $_.FullName -parent
Start-Process "$PathToZipper\7z.exe" -ArgumentList " a -tzip `"$PathToFile`" `"$($_.FullName)`""}