Automatic File and Folder Backup using .bat File.
Automatic File and Folder Backup using .bat File.
Syntax
Xcopy <Source> [<Destination>] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d [:MM-DD-YYYY]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a | /m}] [/n] [/o] [/x] [/exclude:FileName1[+[FileName2]][+[FileName3]]] [{/y | /-y}] [/z] [/b] [/j] [/compress]
CMD ::: Method-1, Backup to same PC but different Drive, Location, Server location using map LINK ::: >> Backup-Files-Folder-Autamatically
here, we mapped a server drive as a drive letter 'Z' and Copy files from source to server Z-drive
-----------------
(open the notepad and copy
paste the following cmd and save this (.txt) file as .bat file and run or create a
Schedular Task for automation)
Syntax : xcopy
fileFolderMode SourcePath DestPath
:: For copy files from local PC to local PC similar to mapped server drive
@ECHO OFF
ECHO Backup started!
xcopy /d /f /s /y /z C:\Users\%COMPUTERNAME%\Desktop\STEST Z:\DTEST
ECHO Backup Completed!
Where,
/STEST ; Source Test Folder
/DTEST ; Destination Test Folder
/d ; For Creating a DIR if it doesn't existing in DestPath
/f ; Display the files and folder name as well as
/i ;
/j ; Copies files without buffering for big
files,
/s ; Copy all files and sub-folder in source Path to
Destination path
/y ; Accept the prompt automatically during file overriding
/w ; Press any-key to copy files prompt
/Z ; Resume ability during server connection re-connecting
CMD ::: Method-2, Backup to Server or shared path of another PC
------------------
Hint :: Simply we can use the first method by using map network drive of server to the Source PC
Syntax : xcopy fileFolderMode
SourcePath serverPath
:: For copy files from local PC to server
xcopy /f /j /s /w /z C:\STEST "\\SERVER-pc-Name\DTest"
e.g.
xcopy /d /f /s /y /z C:\STEST "\\192.168.1.10\DTEST"
here, we mapped a server drive as a drive letter 'Z' and Copying a files from source to server Z-drive
No comments: