Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to write a powershell script which zip the files and folders using 7zip where the files and folders should be in the same structure and only those files should be copied which are X days older. The files Zipped should be in the same file or folder structure.


Any body please help. I am new into PS Scripting
Posted
Updated 6-Dec-14 3:10am
v6
Comments
Richard MacCutchan 6-Dec-14 6:07am    
What error?
ZurdoDev 6-Dec-14 15:36pm    
Where are you stuck?
Member 11290409 7-Dec-14 9:00am    
Get-ChildItem F:\log | where-object {$i.lastwritetime -le ((Get-Date).AddDays(-1))} | Copy-Item -destination F:\new
$SFOLDER= "F:\log"
$DSTFOLDER= "f:\new\"
if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"}
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"

Please find the script in which the files zipped are not as per the folder and file structure. Also i believe its not a perfect script.

Script error while running in prompt

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900