I'm trying to do a batch script that will do a backup of file(s)/directorie(s), which the path is given by the user. The problem is that I need to let the user decide on how many path he want to enter(can be over 10),and then after make a copy of all the files/directories in a new directories. So far I made this which only take one path as argument:
SET /P numuser=How many paths?
SET /P pathh=Enter the path
SET "foldname=sav-%DATE%-%TIME:~0,8%
SET "foldname=%foldname::=-%
echo foldname=%foldname%
mkdir "%foldname%"
cd "%foldname%"
xcopy "%pathh%" "%cd%"
pause
I'm not quite sure on how to be able to store all the different paths in different variables, considering that the use decide on the number of path. So I cannot initialize variable like "SET path1=""SET path2="etc... Since I can't know the numbers of path I'm going to need. I guess I need a loop:
FOR %%c IN(numuser) DO
SET /P path1=enter the path
xcopy "%path1%" "%cd%"
But here again I got the problem that path variable name. I would need to increment and create new variable as the loop progress. I don't know how to do this.