I want to create a batch file which copy the content of folder and paste it into another folder. Say
source: D:\backup\test
destination: D:\backup1
But here i want to create a subfolder into destination into which i can paste the file.
@echo off
:: variables
echo Backing up file
set /P source=Enter source folder:
set /P destination=Enter Destination folder:
set listfile=xcopy /L
set xcopy=xcopy /S/E/V/Q/F/H
%listfile% %source% %destination%
echo files will be copy press enter to proceed
pause
%xcopy% %source% %destination%
pause
The
if not exist
checks to see if the directory exists. If it does not,mkdir
creates it.