?
Solved

Zipping Multiple Folders using 7z

Posted on 2011-03-14
5
Medium Priority
?
438 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 13

Accepted Solution

by:
soostibi earned 750 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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

752 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