Tuesday, June 25, 2019

Copied files and folder by DOS

If you want to copy files and foldes from one location to other location by just on one click.
You can make it with as simple .bat file in DOS.
Just copy the below code on notepad and  save it copyfolder.bat.

@echo off
:: variables
set SourceFolder=D:\Source
set TargetFolder=D:\Target
set FolderWithDate=%date:~10,4%_%date:~4,2%_%date:~7,2%
set backupcmd=xcopy /s /c /d /e /h /i /r /k /y
echo ### Backing up source directory...
%backupcmd% "%SourceFolder%" "%TargetFolder%\%FolderWithDate%"
echo ## Backup Complete!

Once you copy the above code in notepad. you can change below things
Your  source folder which need to be copy: D:\Source
Your target folder where you want to copy it: D:\Target

I hope it will help  you. Thanks

1 comment: