Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,755 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,447 people online right now. Registration is fast and FREE... Join Now!




Help me Please

 
Reply to this topicStart new topic

Help me Please, I Suck

Cybertooth
23 Feb, 2007 - 05:17 AM
Post #1

New D.I.C Head
*

Joined: 22 Feb, 2007
Posts: 2


My Contributions
I'm no coder and it's taking me too long to try and create this. I want to be able to select which environment in the command window and back up 2 directories on the server or multiple servers and delete the contents of another directory upon selection. Here is what I pieced together so far, but of course it's still not working. It looks kind of funky in the copy, but the asterisks just create a box around the environment/server selection.

P.S. I replaced the sensitive info with XXX to protect the innocent
If you could please assist me and send any solutions to my email address .... shaunpuppyabrahams@yahoo.com

echo off
setlocal

SET RunFile=RunFile.txt

cls
echo *******************************************************************************
echo * Backups *
echo * *
echo * This routine backs up the CURRENT and PROPERTIES directories and deletes the contents of the RESOURCES directory for xxx application. *
echo * *
echo * Select the Environment being backed up: *
echo * [1]:UAT Column1 XXX *
echo * *
echo * *
echo * [2]:UAT Column2 XXX *
echo * *
echo * *
echo * [3]:PROD Column1 (XXX), Column2 (XXX), *
echo * Column3 (XXX), Column4 (XXX), *
echo * Column5 (XXX), Column6 (XXX) *
echo * Column7 (XXX) , Column8 (XXX) *
echo * *
echo * *
echo * [4]: DEMO1 (XXX) *
echo * *
echo * *
echo * [5]: DEMO2 (XXX) *
echo * * echo * *
echo * [Q]:to Quit without backing up any files. *
echo * *
echo *******************************************************************************
:STARTLOOP
SET Choice=
SET /P Choice=-
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
IF /I '%Choice%'=='1' GOTO 1
IF /I '%Choice%'=='2' GOTO 2
IF /I '%Choice%'=='3' GOTO 3
IF /I '%Choice%'=='4' GOTO 4
IF /I '%Choice%'=='5' GOTO 5
IF /I '%Choice%'=='Q' GOTO QUITEXIT
ECHO "%Choice%" is not valid. Please try again.
ECHO.
GOTO STARTLOOP


:1
SET Server=XXX
SET UserID=XXX
SET PWID=XXX
GOTO STARTROUTINE
:2
SET Server=XXX
SET UserID=XXX
SET PWID=XXX
GOTO STARTROUTINE
:3
SET Server=XXX
SET Server=XXX
SET Server=XXX
SET Server=XXX
SET Server=XXX
SET Server=XXX
SET Server=XXX
SET Server=XXX
SET UserID=XXX
SET PWID=XXX
GOTO STARTROUTINE
:4
SET Server=XXX
SET UserID=XXX
SET PWID=XXX
GOTO STARTROUTINE
:5
SET Server=XXX
SET UserID=XXX
SET PWID=XXX
GOTO STARTROUTINE

:STARTROUTINE


%UserID%>> %RunFile%
%PWID%>> %RunFile%
echo :: variables
echo set folder=%date:~10,4%%date:~4,2%%date:~7,2%
echo set backupcmd=xcopy /s /c /d /e /h /i /r /k /y
echo.
echo ### Backing up Application's CURRENT and PROPERTIES directories ###
echo %backupcmd% "X:\Projects\APPLICATION\current" "%drive%\%folder%\current"
echo %backupcmd% "X:\Projects\APPLICATION\properties" "%drive%\%folder%\properties"
echo.
echo ### Removing contents of Application's RESOURCES directory ###
echo rm X:\Projects\Application\resources\*.*
echo Backup Complete!


GOTO ENDROUTINE

:ENDROUTINE
endlocal
@pause



Any help will be much appreciated
User is offlineProfile CardPM
+Quote Post

jstephens
RE: Help Me Please
23 Feb, 2007 - 09:03 PM
Post #2

D.I.C Head
**

Joined: 7 Nov, 2005
Posts: 192



Thanked: 1 times
My Contributions
You have posted this multiply times. Post what exactly is not working in your script. Also this looks more like a batch file than it does a c++ program. I do suggest you use a more powerfull program. Like either vbscript or use c++ to create a more robust version.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 05:56AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month