Last active
August 29, 2015 14:16
-
-
Save zenofile/6059cda010b3cc396800 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM # Send To Backup Script | |
REM # Author - Matt Little (http://matthewjlittle.com) | |
REM # Adam Caudill (http://adamcaudill.com) | |
REM # | |
REM # To install: | |
REM # | |
REM # (windows 7): | |
REM # Goto Start->Run. Type in shell:sendto | |
REM # Save as Backup.bat | |
REM # | |
REM # To use: | |
REM # right click on the folder you want to backup and click on the batch file | |
REM # in the sendto menu. | |
REM # | |
REM # Example: | |
REM # | |
REM # If you are in this folder and run the script on Production folder a | |
REM # backup of the folder is placed in | |
REM # X:\App\Prod\Backups\Prod.YYYY.MM.DD.HHMI.zip | |
REM # | |
set year=%date:~-4,4% | |
set month=%date:~-10,2% | |
set day=%date:~-7,2% | |
set hour=%time:~-11,2% | |
set hour=%hour: =0% | |
set min=%time:~-8,2% | |
set zipfilename=%~n1.%year%.%month%.%day%.%hour%%min%.zip | |
set destination=%~dp1 | |
set source="%~1\*" | |
set dest="%destination%Backups\%zipfilename%" | |
set AppExePath="%ProgramFiles(x86)%\7-Zip\7z.exe" | |
if not exist %AppExePath% set AppExePath="%ProgramFiles%\7-Zip\7z.exe" | |
if not exist %AppExePath% goto notInstalled | |
echo Backing up %source% to %dest% | |
%AppExePath% a -rtzip %dest% %source% | |
echo %source% backed up to %dest% is complete! | |
goto end | |
:notInstalled | |
echo Can not find 7-Zip, please install it from: | |
echo http://7-zip.org/ | |
:end | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment