Manipulate files with Batch

2

I want to make a BackUp of a folder with all its files, called "DATA", and make a Backup, every time that it runs in a .BAT file, it is backed up.

    
asked by CarlosR93 26.05.2017 в 22:38
source

3 answers

1

Maybe the following link will serve you: link

You have a code example:

@echo off
:: variables
set drive=G:\Backup
set backupcmd=xcopy /s /c /d /e /h /i /r /y

echo ### Backing up My Documents...
%backupcmd% "%USERPROFILE%\My Documents" "%drive%\My Documents"

echo ### Backing up Favorites...
%backupcmd% "%USERPROFILE%\Favorites" "%drive%\Favorites"

echo ### Backing up email and address book (Outlook Express)...
%backupcmd% "%USERPROFILE%\Application Data\Microsoft\Address Book" "%drive%\Address Book"
%backupcmd% "%USERPROFILE%\Local Settings\Application Data\Identities" "%drive%\Outlook Express"

echo ### Backing up email and contacts (MS Outlook)...
%backupcmd% "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook" "%drive%\Outlook"

echo ### Backing up the Registry...
if not exist "%drive%\Registry" mkdir "%drive%\Registry"
if exist "%drive%\Registry\regbackup.reg" del "%drive%\Registry\regbackup.reg"
regedit /e "%drive%\Registry\regbackup.reg"

:: use below syntax to backup other directories...
:: %backupcmd% "...source directory..." "%drive%\...destination dir..."

echo Backup Complete!
@pause
    
answered by 27.05.2017 / 00:09
source
-1

This task is executed in Linux to make backups :

#!/bin/bash
directorio="ruta_del_diretorio"
if [ "$(ls -A $directorio)" ]; then
cp /ruta/al/directorio/origen/* /ruta/al/directorio/destino
fi
    
answered by 26.05.2017 в 23:59
-1

You can download zip from this route (search zip.exe )

link

Then, in the windows batch (cmd) you can use:

zip -r data.zip data

Done, with that you create a data.zip file with the contents of the folder

    
answered by 26.05.2017 в 22:58