Script for backup for windows ( Regular Files and foder data )

@echo off


REM Specify the network folder path

set "network_folder=sourcePath


REM Specify the destination folder for the backup

set "backup_folder=destinationPath


REM Create a timestamp for the backup filename

set "timestamp=%DATE:/=_%%TIME::=_%"

set "timestamp=%timestamp: =%"


REM Replace characters that are not allowed in Windows filenames

set "timestamp=%timestamp:/=-%"

set "timestamp=%timestamp::=-%"

set "timestamp=%timestamp:.=-%"

set "timestamp=%timestamp:~0,19%"


REM Create a backup filename using the timestamp

set "backup_filename=backup_%timestamp%.zip"


REM Use the Robocopy command to copy the files from the network folder to the backup folder

robocopy "%network_folder%" "%backup_folder%" /E /Z /NP /NFL /NDL /NJH /NJS /R:0 /W:0


REM Check if the backup process was successful

if %ERRORLEVEL% equ 0 (

    echo Backup created successfully: %backup_filename%

) else (

    echo Backup creation failed.

)


Here's how to use the script:

  1. Open Notepad or any text editor.
  2. Copy and paste the above script into the text editor.
  3. Replace the sourcePath variable with the network path to the folder you want to back up.
  4. Replace the destinationPath variable with the local path to the folder where you want to store the backup.
  5. Save the file with a .bat extension, for example, backup_script.bat.
  6. Double-click the script file to run it.

The script will use the Robocopy command-line tool to perform the backup. It will create the destination folder if it doesn't exist and copy all files and subfolders from the source to the destination. The script also logs the backup process to a text file located in the destination folder.

Please note that you may need appropriate access rights to both the network location and the destination folder in order to perform the backup successfully.



Note - no space is needed on the backup folder name link


yes - backupsoft


no -  backup soft

Comments

Popular posts from this blog

RV325 BAD CERTIFICATE no access to 192.168.1.1 impossible complete restore using. Certificat persistent

What is internet