Advertisement

12.18.2006 at 06:15PM PST, ID: 22097412
[x]
Attachment Details

How to Loop List of Variables

Asked by matrixnz in MS DOS

Tags: loop, list, dos

I have a script I created that I use to backup WebDesign Clients Sites using a scheduled backup, the hosting account is a reseller account so we have access to all sites.

The Script
@ECHO OFF

SET USRNAME=Username
SET PSSWORD=P@ssw0rd
SET DWNLOAD=%SYSTEMDRIVE%\SiteBackup\wget.exe
FOR /f "tokens=2-4 delims=/ " %%a in ('DATE/T') do set mdate=%%c-%%b-%%a

SET DOMAIN=domain.com

CD /D %SYSTEMDRIVE%\SiteBackup
MKDIR %MDATE%
CD /D %MDATE%

MKDIR %DOMAIN%
CD /D %DOMAIN%
"%DWNLOAD%" -c http://%USRNAME%:%PSSWORD%@%DOMAIN%:2082/getbackup/%MDATE%-%DOMAIN%.tar.gz
"%DWNLOAD%" -c http://%USRNAME%:%PSSWORD%@%DOMAIN%:2082/getsqlbackup/database1.gz
"%DWNLOAD%" -c http://%USRNAME%:%PSSWORD%@%DOMAIN%:2082/getsqlbackup/database2.gz
"%DWNLOAD%" -c http://%USRNAME%:%PSSWORD%@%DOMAIN%:2082/getaliasbackup/aliases-%DOMAIN%.gz
"%DWNLOAD%" -c http://%USRNAME%:%PSSWORD%@%DOMAIN%:2082/getfilterbackup/filter-%DOMAIN%.gz

Normally for %Domain% I use an actual name and just duplicate the several lines below for each domain, which is pain when you have 30 - 40 clients sites.  My question is it possible to create a list of the domains so that all it does is read the line run the script, read the second line etc..

Hope that makes sense, any help would be much appreciated.

CheersStart Free Trial
 
 
[+][-]12.18.2006 at 07:46PM PST, ID: 18163558

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS DOS
Tags: loop, list, dos
Sign Up Now!
Solution Provided By: leew
Participating Experts: 1
Solution Grade: A
 
 
[+][-]12.18.2006 at 08:28PM PST, ID: 18163696

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32