Last active
October 10, 2020 14:59
-
-
Save guillaC/bb502c3f40a28b2b88be1dd791c0b218 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 | |
::Configuration | |
SET folderPath=C:\Users\Guillaume\Desktop\fiverrorderFO1B3039F9A5\backuppls\ | |
SET backupPath=C:\Users\Guillaume\Desktop\fiverrorderFO1B3039F9A5\ | |
SET SubExcept[0]=sub3 | |
SET SubExcept[1]=sub4 | |
SET /A i = 0 | |
::ClearBackupFolder | |
ForFiles /p %backupPath% /s /m *.zip /d -7 /c "cmd /c del @file" | |
::Backup | |
xcopy %folderPath% %backupPath%\bckp\ /E | |
:looop | |
if defined SubExcept[%i%] ( | |
call rmdir /S /Q %backupPath%\bckp\%%SubExcept[%i%]%% | |
set /a i = %i% + 1 | |
goto :looop | |
) | |
SET zipName=%date:~3,2%-%date:~0,2%-%date:~6,4%-%time:~0,2%.zip | |
powershell.exe Compress-Archive %backupPath%\bckp %backupPath%%zipName% | |
rmdir /S /Q %backupPath%\bckp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment