Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

UNZIP PowerShell Script

$
0
0

Hi group. I’m new to Powershell and need help. I’m would like to create a Powershell script that would unzip file extension *.zip. The file name contains PB or HB along with date and month [For example: PBSTMT20141126.zip and HBSTMT20141126.zip. Upon unzipping the files they should go in a folder that corresponds with name and date (See example 1). If folders don’t exist the script would create the folder ‘Year’ and subfolder ‘Month’. Next, create a log file to \\server\share\CHRMC\PB or HB\ZipArchives named  ‘UNZIP_PByear,month’ and ‘UNZIP_HByear,month’ writing all files that have extracted from .zip. Finally, if possible I would like a comparison to count and compare files in zip compared to what extracted within UNZIP log file and send email.

Example 1:
PBSTMT20141126.zip located in $src \\server\share\CHRMC\PB\Archives would need to unzip to \\server\share\CHRMC\PB\2014\11
[If folder(s) 2014\11 are not created they would need to be created]
• Create a log file writing files being extracted from zip
• Compare extracted files written in log to files in .zip and send email with results

And

HBSTMT20141126.zip located in $src \\server\share\CHRMC\HB\Archives would need to unzip to
 \\server\share\CHRMC\HB\2014\11
[If folder(s) 2014\11 are not created they would need to be created]
• Create a log file writing files being extracted from zip
• Compare extracted files written in log to files in .zip and send email with results


Viewing all articles
Browse latest Browse all 6937

Trending Articles