Last active
August 29, 2015 14:06
-
-
Save andcar72/f6fdb28241ee6245722c to your computer and use it in GitHub Desktop.
back.cmd - Backup di file e cartella da un file -ini - SOLO TCC/LE
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 | |
:: Scritto cosi funziona solo su TCC/LE | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
CD /D "%~d0%~p0" | |
IF "%1" == "" GOTO nopar | |
IF NOT EXIST "%1" GOTO nodest | |
SET /P _scelta=Cartella di destinazione "%1\", e' corretto? (S/N)? || SET _scelta=N | |
IF "%_scelta%" NEQ "s" EXIT /B | |
SET DEST=%1 | |
SET EXEC=Robocopy | |
SET OPT=/mir /xj /e /R:2 /W:5 /XO | |
::SET OPT=/mir /xj /e /R:2 /W:5 /LOG:BackLogfile.txt /NFL /NDL | |
:: file di configurazione delle cartelle e file da backupare su back.ini | |
:: i commenti cominciano con # | |
:: per il backup si usa robocopy | |
CLS | |
for /f "eol=# tokens=1-2 delims=," %%A in (back.ini) do IF "%%A" EQU "F" call:COPIAFILE | |
for /f "eol=# tokens=1-2 delims=," %%A in (back.ini) do IF "%%A" EQU "D" call:COPIADIR | |
Exit /b | |
:COPIADIR | |
SET DESTFOLDER=%%~nxB | |
echo Inizio copia di %%A %%B | |
::ECHO %DESTFOLDER% | |
wait 3 | |
:: ESEGUE COMANDO BACKUP | |
%EXEC% %%B "%DEST%\%DESTFOLDER%" %OPT% | |
GOTO:EOF | |
EXIT /B | |
:COPIAFILE | |
echo Inizio copia di %%A %%B | |
wait 3 | |
COPY /Y %%B "%DEST%" | |
GOTO:EOF | |
EXIT /B | |
:nopar | |
Echo Manca la cartella di destinazione | |
Echo. | |
Echo ESEMPIO: back.cmd d:\backup | |
exit /b | |
:nodest | |
Echo La destinazione non esiste "%1" | |
exit /b |
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
#Cartelle da backupare | |
D,"C:\script" | |
D,"C:\Users\Andrea\Copy" | |
D,"C:\Users\Andrea\Desktop\FilmFE" | |
D,"C:\ProgramData\WoodWing" | |
D,"C:\Users\Andrea\Desktop\FilmFE" | |
F,"C:\Windows\System32\drivers\etc\hosts" | |
D,"C:\Users\Andrea\ConEmu" | |
D,"C:\Users\Andrea\Apps" | |
D,"C:\Program Files (x86)\Cisco Systems\VPN Client\Profiles" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment