[Batch] Backup Entire Folder with Current Date and Time

During my work on documentations, I usually will need to take different  snapshots of the current documentations folder at every milestone.

This batch will ask you for the folder you want to backup, then will create a new folder inside this folder named “AutoBackup” –> then will create a new folder with the current date and time inside this AutoBackup folder.

@Echo off
SETLOCAL
SET /P BackupPath=Please Enter the Folder Path to Backup:
MD "%BackupPath%\AutoBackup"
Set FolderNameFull=%BackupPath%\AutoBackup\%date:/=-%_%time::=%
Set FolderNameFinal=%FolderNameFull:~0,-5%
MD "%FolderNameFinal%"
Robocopy "%BackupPath%" "%FolderNameFinal%" /E /XD *AutoBackup
ENDLOCAL
Pause

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s