Solved

Zipping Multiple Folders using 7z

Posted on 2011-03-14
5
433 Views
Last Modified: 2012-05-11
Hi Guys,

I got hundreds of folders in one directory

Path : I:\sourcefiles\

Folders Names as followed

WE_20110130
WE_20110129
WE_20110128
WE_20110127
WE_20110126

so on....

I want to zip this folder with exact name using 7zip to different directory using script

example to

I:\DestinationZipFiles\

Followed by zip files


WE_20110130.zip
WE_20110129.zip
WE_20110128.zip
WE_20110127.zip
WE_20110126.zip


My 7Zip exe is located in C:\Program Files\7-zip\7z.exe

Any help thanks

D
0
Comment
Question by:Dreamslogic
  • 3
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
soostibi earned 250 total points
ID: 35133596
What about this PowerShell solution?
Get-ChildItem I:\sourcefiles | ForEach-Object {
    Start-Process -FilePath "C:\Program Files\7-Zip\7z.exe" -ArgumentList "a -r -tZIP I:\DestinationZipFiles\$($_.name) $($_.fullname)\*.*"
}

Open in new window

0
 

Author Comment

by:Dreamslogic
ID: 35134043

I am sorry but it didn't worked. It doesn't do anything !
0
 
LVL 13

Expert Comment

by:soostibi
ID: 35136213
For me it works like a charm! Do you copied the code correctly?
Does the 'Get-ChildItem I:\sourcefiles' part give any result?
Do you get any error messages?
0
 

Author Comment

by:Dreamslogic
ID: 35413389
Ok
0
 

Author Closing Comment

by:Dreamslogic
ID: 35413392
Worked !!
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
A procedure for exporting installed hotfix details of remote computers using powershell
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now