37.1 C
Cuttack
Sunday, April 14, 2024
HomeWindowsTo create a batch file to copy folder and its contents to...

To create a batch file to copy folder and its contents to a destination folder

A simple batch file to copy  folder and its contents to a destination folder

This will help you to keep backup of your default mail store folder periodically to other drive.

Open a notepad and type the below lines and save the notepad as backup.bat. When you double click the backup.bat file, It will start copying and with a note in command prompt the number of files copied.

@echo off
xcopy /W /E /H /R /Y “D:/copy1” “D:/backup”
pause
exit

/W – Prompt you to press a key before starting to copy.
/E – Copy folders and sub folders, including Empty folders.
/H – Copy hidden and system files and folders (default=N)
/R – Overwrite read-only files.
/Y – Suppress prompt to confirm overwriting a file

You can replace the source and destination location as per your requirement
in my sample program – “D:/copy1” – Source
“D:/backup” – Destination

Go ahead, Do it and Enjoy

I can reach at : durgacharanojha@yahoo.co.in
Durga Charan Ojhahttps://lifeonnetwork.com/
I am a proud Indian, proud father, a blogger, Being in a profession as System administrator, my passion is troubleshooting computer issues, I do like sharing solutions through blogging making videos of solving issues.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular