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

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.