Page 1 of 1

A Little project backing up folders

Posted: 24 Jan 2019 16:46
by Stevo
Hello everyone,

I have just discovered this forum. I have written the odd trivial batch file, nothing sophisticated. My current task is to back up my Music folder on to four USB thumb drives that individually are smaller than the music collection. My pseudo code is below. Please comment on weather this is a reasonable approach given the functionality available in batch programming. Currently I have no clue how to implement this but it's easy to find out with a bit of research.

batch file runs inside Music Folder
treat folders in alphanumeric order

Variable = the folder being copied
copy Variable to F:
exit loop if F: runs out of space
increment Variable to next folder
Loop back to "copy Variable to F:"

Delete Variable from F:
REM last attempt will be a partially copied folder

copy Variable to G:
exit loop if G: runs out of space
increment Variable to next folder
Loop back to "copy Variable to G":

Delete Variable from G:
REM last attempt will be a partially copied folder

copy Variable to H:
exit loop if H: runs out of space
increment Variable to next folder
Loop back to "copy Variable to H":

Delete Variable from H:
REM last attempt will be a partially copied folder

copy Variable to I:
exit loop if I: runs out of space
increment Variable to next folder
exit loop if we run out of folders
Loop back to "copy Variable to G":

Exit

Re: A Little project backing up folders

Posted: 25 Jan 2019 12:55
by pieh-ejdsch
Hello Stevo,

I once had a similar requirement, with just a backup should be divided into several media.
Maybe this can help you here.
Please test it and let me know.
If you need it I can provide an English version.
https://administrator.de/forum/robocopy ... ent-780547

Phil

Re: A Little project backing up folders

Posted: 29 Jan 2019 03:11
by Stevo
Thanks Phil,

That is a comprehensive script. Unfortunately far beyond my understanding. I was going to start simply and build up. Perhaps you can assist with this.

ECHO OFF

FOR /f "delims=" %%a in (list.txt) do (
ECHO %%a
SET /p var= %%a

ECHO:%var%

robocopy "%var%" F:"%var%"

)

This has two problems. It requires an enter key stroke to manually continue the loop and robocopy only works when the directories listed in list.txt have no spaces.