Created
September 5, 2015 19:31
-
-
Save NobleUplift/c7ae8a18eba6406e0df4 to your computer and use it in GitHub Desktop.
Batch script for backing up Mozilla products
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 Created on 2012 January 13th at 06:32 PM. | |
REM Installation Instructions | |
REM 1. Create your Backups/Mozilla directory and move BackupMozilla.bat into Backups. | |
REM 2. Open Task Scheduler (Control Panel\All Control Panel Items\Administrative Tools). | |
REM 3. In the root of Task Scheduler Library, click Create Task. | |
REM 4. Name the task Backup followed by the Mozilla project you are backing up. | |
REM 5. Go to Triggers and create a new trigger. | |
REM 6. Set the repetition and time to how frequently you want your Mozilla product backed up. | |
REM 7. Go to Actions and create a new action. | |
REM 8. Start a program and Browse... to the location of BackupMozilla.bat. | |
REM 9. In "Add arguments", place any changes you require i.e. "Thunderbird" "%USERPROFILES%\Backups", etc. | |
REM 10. In Settings, click "Run task as soon as possible after a scheduled start is missed" and you're done! | |
SET C=%CD% | |
IF [%1]==[] ( | |
SET PRODUCT=Firefox | |
) ELSE ( | |
SET PRODUCT=%1 | |
) | |
IF [%2]==[] ( | |
SET BACKUPDIR=%USERPROFILE%\Backups\Mozilla | |
) ELSE ( | |
SET BACKUPDIR=%2 | |
) | |
ECHO Backing up %PRODUCT%. Please: | |
ECHO - Log out of all websites. | |
ECHO - Delete all of your cookies. | |
ECHO - Clear your cache. | |
ECHO And close %PRODUCT%. | |
ECHO | |
CHOICE /C YN /D N /T 60 /M "Is %PRODUCT% closed?" | |
IF %ERRORLEVEL%==2 ( | |
TASKKILL /IM %PRODUCT%.exe | |
ECHO Waiting for program to close... | |
PING 1.2.3.4 -n 1 -w 10000 >NUL | |
) | |
FOR /F "tokens=* delims=" %%A IN ('DATE/T') DO SET DATE=%%A | |
SET DATE=%DATE:~0,10% | |
CD %APPDATA%\Mozilla\%PRODUCT%\Profiles | |
FOR /F "tokens=* delims=" %%D IN ('DIR/B') DO ( | |
"C:\Program Files\7-Zip\7z.exe" a -tzip "%BACKUPDIR%\%PRODUCT%\Profiles\%%D_%DATE%.zip" "%CD%\%%D" | |
ATTRIB +R "%BACKUPDIR%\%PRODUCT%\Profiles\%%D_%DATE%.zip" | |
) | |
CD %C% | |
EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment