Skip to content

Instantly share code, notes, and snippets.

@NKid

NKid/backup.bat Secret

Last active July 28, 2020 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NKid/5aa212dc9ca669e700f4 to your computer and use it in GitHub Desktop.
Save NKid/5aa212dc9ca669e700f4 to your computer and use it in GitHub Desktop.
[備份 Firefox Profile] #firefox
@ECHO OFF
ECHO ===[備份] Firefox Profile (by NKid)===
TASKLIST /FI "IMAGENAME eq firefox.exe" 2>NUL | FIND /I /N "firefox.exe">NUL
IF "%ERRORLEVEL%"=="0" (
ECHO [ERROR] Firefox is running. Please closing Firefox before backup.
GOTO END
)
ECHO ===[sqlite3] 壓縮資料庫===
IF NOT EXIST sqlite3.exe (
ECHO [ERROR] sqlite3 Not Found.
GOTO END
)
FOR %%i IN (D:\MySoftware\fxProfile\*.sqlite) DO sqlite3 %%i VACUUM | ECHO %%i
ECHO ===[7z] 產生備份檔===
FOR /F "tokens=1-3 delims=/ " %%a IN ('DATE /T') DO (SET MYDATE=%%a-%%b-%%c)
SET NowTime=%time: =0%
"C:\Program Files\7-Zip\7z.exe" a -mx9 "D:\MySoftware\Firefox\Profile_%MYDATE%-%NowTime:~0,2%-%NowTime:~3,2%-%NowTime:~6,2%.7z" "D:\MySoftware\fxProfile" -xr!Cache
:END
PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment