Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Zipping Multiple Folders using 7z

Posted on 2011-03-14
5
Medium Priority
?
439 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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…

618 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