i have a simple backup script basically copies the files from the source folder to the backup folder but the subroutine is just running in a constant loop. what i want it to do is ask if i want to copy each file one by one and when all of them are copied finish here is the script.
@echo off
echo.
echo The time is %time% on %date%.
echo.
echo.Backup Starting...
echo.
echo Checking if the source folder exists...
echo.
if exist "%C:\Users\Lee\Project\%" ( REM checks if the source folder exists
set formerDir=%cd% REM sets the former directory
echo source folder exists.
) else ( REM if the source folder doesnt exist user is notified
echo it doesn't exist
)
echo.
echo Checking if the Backup folder exists...
echo.
if exist "%C:\Users\Lee\Backup\%" ( REM checks if the backup folder exists
set formerDir=%cd% REM sets the former directory
echo Backup folder exists.
) else ( REM if the backup folder doesnt exist user is notified
echo Backup folder doesn't exist.
echo.
echo Creating Backup folder...
md%C:\Users\Lee\Backup\% REM backup folder is created
echo.
echo Folder has been created. REM user is notified
)
:Subroutine REM the subroutine
echo.
echo %C:\Users\Lee\Project
dir "%C:\Users\Lee\Project"
echo.
set /p p="Do you want to copy this file(Y/N)?" REM user is asked if they want to copy the file
echo.
echo %p%
if "%p%" == "y" ( REM is the user replies yes the file is copied to the backup folder
echo.
xcopy /s C:\Users\Lee\Project C:\Users\Lee\Backup
attrib +r "C:\Users\Lee\Backup"
echo.
echo File has been copied.
) else (
echo.
echo Skipped
echo.
)
call :Subroutine
echo.
echo Backup Complete!
echo.
echo Press enter to exit.
pause >nul REM results are paused on screen for the user
exit
any help greatly appreciated