Solved

Zipping Multiple Folders using 7z

Posted on 2011-03-14
5
432 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

707 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

13 Experts available now in Live!

Get 1:1 Help Now