Archiving using 7ZIP commandline

Couple of days back I had to create a script to archive all files from number folders as part of bigger data transfer task. Since that machine was a bit of older flavor of Windows it didn’t had PowerShell, and I had to reboot machine is I wanted to install PowerShell so I decided to use my favorite script language … batch script to accomplish task.

In my script I used WinRAR (because we have licenses for that) but since I have 7ZIP at home machine, I have modified a script to use 7Zip instead of WinRAR (other business logics). I have one folder called “sample” and this script archives all files located inside of this folder and creates a 7ZIP file called Test.7z. It is just one line command,

 D:\Program Files (x86)\7-Zip\7z" a -t7z C:\Users\gaurang\Desktop\Sample\Test.7z C:\Users\gaurang\Desktop\Sample\ 

It’s Just A Thought … Peace

Gaurang Sign

Leave a Reply

Your email address will not be published. Required fields are marked *