Home Page

Home Page
How to Search the Query

Saturday 22 February 2014

Making Batch File to copy files over the network and automatically zipped with current Date

How to create Batch file for copy backup over the network and zipped using 7Zip Utilities

How it is work :"
  • Batch file can be copy Data / backup over the network.
  • Backed up files/folders automatically zipped using 7Zip Utility and save with the current date format.
  • unzipped files will be delete automatically.
Procedure to create batch file :

Download 7Zip Utility ( it is using for zip - UN-zip the files and folder) from the Internet and extract or install on your local system.
Copy 7z.exe from the 7zip

  1. Open Notepad > Copy Below all commands mark in Red in the notepad and save it as a .bat
  2. Copy 7z.exe in "C:\Windows\System32"
Note : IF you Extract the "7zip.exe" then u will find the "7z.exe" in extracted folder OR if you installed 7zip in your local system then "7z.exe" will be available at C:\Program Files\7-Zip)

 1) Batch File for Local Machine Backup :


@Echo off
color 02
xcopy C:\SourceFolderName\*.* D:\FolderName\*.* /e /h /r /y

7z a -tzip D:\DestinationFolderName\FileBackup.zip "D:\DestinationFolderName\FileBackup.bkf"

rename "D:\DestinationFolderName\FileBackup.zip" 
%Date:~-10,2%_%Date:~-7,2%_%Date:~-4,4%.zip
  
del C:\SourceFolderName\FileBackup.bkf

del D:\DestinationFolderName\FileBackup.bkf
 

Here we Copied "FileBackup.bkf" file from Local "C" Drive to Local Machine "D:\Destination FolderName\FileBackup.bkf" and make a zipped copy for the same file using 7Zip "FileBackup.zip" and rename the "FileBackup.zip" as current Date Format Like "2-22-2014.zip"

  2) Batch File for Remote Machine to Local Backup :


@Echo off
color 02
xcopy \\IP address of Remote Machine\FolderName\*.* D:\Destination FolderName\*.* /e /h /r /y

7z a -tzip D:\Destination FolderName\FileBackup.zip "D:\Destination FolderName\FileBackup.bkf"

rename "D:\Destination FolderName\FileBackup.zip"
%Date:~-10,2%_%Date:~-7,2%_%Date:~-4,4%.zip

del D:\Destination FolderName\FileBackup.bkf

del \\IP address of Remote Machine\FolderName\FileBackup.bkf



Here we Copied "FileBackup.bkf" file from Remote Machine to Local Machine "D:\Destination FolderName\FileBackup.bkf" and make a zipped copy for the same file using 7Zip "FileBackup.zip" and rename the "FileBackup.zip" as current Date Format Like "2-22-2014.zip" 


Searches Related Links:
How to create Batch File for copying file from one computer to another computer 
batch file to copy files from one folder to another folder 
how to create batch file to auto zip files using 7zip  
How to Backup Using Batch File 
How to Auto Zipping files using Batch file 
making batch file asking enter date to copy from network 
Zipped files using batch files 
batch file to copy files and convert in zip with current Date 
batch file to copy files and convert with current date format 

1 comment:

  1. If I have to copy it from userd drive of remote server to local. How can we do this

    ReplyDelete

Thank you for logging in.. Waiting for your valuable views.