ok, I'm new to this. Today I discovered XCopy. It is amazing. Now I'm trying to write a batch routine to automate backing up multiple folders from different locations. I could try and do it via vba which I can just about write in, but I thought it would be good to start learning about using the cmd line functions.
I've got two ini files each with a list of folder paths (all in "" and separated by ; ) eg "K:\folder 1\subfolder 2";"H:\folder 3\subfolder 4" etc
the batch file contains the following code
cd %~dp0
cmd /k For %%S in BackUp_SourceList.ini DO FOR %%d IN BackUp_DestinationList.ini DO Xcopy %%S %%d /S /E /D
it doesn't work. (the second line) - error message is BackUp_SourceList.ini was unexpected at this time.
It is supposed to take each folder path from BackUp_SourceList and copy it to BackUp_DestinationList provided the date is newer or the file doesn't already exist on the backup directory. I'm happy the /S /E /D in xcopy are correct - but I'm clearly not using the For commands properly.
I have also tried
cd %~dp0
cmd /k For %%S in BackUp_SourceList.ini DO XCOPY %%S IN BackUp_SourceList.ini %%S IN BackUp_DestinationList.ini /S /E /D
This also no good.
Is it the way I've compiled the ini files? Should I use "; " as delimiter instead of just ";"
Or is it the way I'm trying to use %%S for each value in the ini files?
Or is it something else?
Please help!