Monday, January 30, 2017

How to create a batch file to Exclude folders to zip from Windows command line


Below given are some easy steps to create a zip file of your files and folders on your computer and copy it to a different drive on your computer.

* Make sure you have either of the file compression software (WinZip / WinRar) installed on your machine.

For Exa: You have folders on your computer's C:\Drive say -

C:\Intel
C:\Logs
C:\Drivers\
C:\Drivers\Printer_Logs
C:\Drivers\Manual_Logs
C:\Drivers\Code_Logs
C:\Drivers\QA_Logs

Now you want to make zip file of "Drivers" folder and want to exclude Sub-folders "Manual_Logs" and "Code_Logs" from zip, below given are the steps to do so.

Goto>Start>Run>Notepad

Once the Notepad is open, type the below given contents:-
____________________________________________

@echo on
winrar a Games.rar C:\Games -x*\file3 -x*\file4
@echo off
_____________________________________________

Enjoy.....

No comments:

Post a Comment