0

Anyone wanna take a crack at this?

Display “File Maintenance Script” in the title bar

Clear the screen

Display a menu of options for delete, rename or exit

Using called procedures, either delete all files in H:\scripts, rename all files so that they have the extension .bak, or simply exit the program

5
Contributors
15
Replies
16
Views
10 Years
Discussion Span
Last Post by WaltP
0

I'm sorry, but Do Your Own Homework. Or at least make an attempt at it.

I am sorry fry but that wasn't the answer I was looking for ;-)

0

Too bad. It's pretty obvious that this is your homework, and asking for help without showing any effort is not encouraged here. Post the code you've got so far, and we might be able to help you with it.

Thanks

No sweat. And glad it was obvious. It was supposed to be. <bfg> I am not doing any complex DB extraction or anything. I think it is presumptious of you to "assume" I have put in no effort. Remember what happens when you assume? "You make a donkey out of yourself" :cheesy:

0

No sweat. And glad it was obvious. It was supposed to be. <bfg> ... I think it is presumptious of you to "assume" I have put in no effort. Remember what happens when you assume? "You make a donkey out of yourself" :cheesy:

OK, look buddy. We're simply not going to do your homework, and insulting us isn't going to make it go any better. If you have been making an effort, you should at least be able to figure out a few of the steps. Tell us which part of the assignment you need help on, or don't understand. For example:

Using called procedures, either delete all files in H:\scripts, rename all files so that they have the extension .bak, or simply exit the program

You should have at least tried to do it. Post some of your attempts; it shows us that you actually want to get it done, and not simply let us do your homework.

I am not doing any complex DB extraction or anything.

Also the fact that you were "disguising" the fact that it was homework is annoying; when you say "Anyone want to take a crack at this," you're making it sound as if it's supposed to be a brainteaser for us to solve. But it's pretty easy to tell that it's your homework, so why not say so?

Not to be harsh or anything, and I'm happy to help you with a part that you're stuck on. But me (and everyone else) don't want you to get marked on something you didn't write.

Thanks.

0

OK, look buddy. We're simply not going to do your homework, and insulting us isn't going to make it go any better. If you have been making an effort, you should at least be able to figure out a few of the steps. Tell us which part of the assignment you need help on, or don't understand. For example:

You should have at least tried to do it. Post some of your attempts; it shows us that you actually want to get it done, and not simply let us do your homework.

Also the fact that you were "disguising" the fact that it was homework is annoying; when you say "Anyone want to take a crack at this," you're making it sound as if it's supposed to be a brainteaser for us to solve. But it's pretty easy to tell that it's your homework, so why not say so?

Not to be harsh or anything, and I'm happy to help you with a part that you're stuck on. But me (and everyone else) don't want you to get marked on something you didn't write.

Thanks.

Nothing was disguised. You give me too much credit. But, that's OK I'll Mark you ;-)

0

Sorry I apologise I thought I would have had more time to respond, but with the holiday and all, anyway I am sorry. I did not mean to insult you. If I did I humbly take it back. I just have a joking-around sense of humor and I guess you'd have to know me to know that. So once again I apologize :-( to :-) I appreciate you comments on the code I am posting below. I am on the road and do not have access to a compilier so forgive any obvious errors. I am sure there is a simplier way but this is my first crack into scripting so here goes...
ps you might even cringe when you see this!

@ECHO off
REM *****************************************************************
REM
REM Script Name: File_Maintenance_Script.bat
REM Author: ME

REM
REM Description: ****************************************************
REM I. Display “File Maintenance Script” in the title bar II. Clear the screen III. Display a menu of options for delete, rename or exit
Using called procedures, either delete all files in H:\scripts, rename all files so that they have the extension .bak, or simply exit the program

REM *****************************************************************

REM Script Initialization Section
IF NOT "%OS%" == "Windows_NT" ECHO Unsupported Operating Systems & GOTO :EOF
 
REM Main Processing Section
REM ****Create the scripts directory****
MKDIR scripts
REM****Sets command line to scripts directory****
cd/scripts
title File Maintenance Script
REM Clear the display
cls
echo (1) delete (2) rename (3) exit
REM *wait to accept input from a keyboard*
:NUMBER
  IF %1 GTR %3% (
    CLS
    ECHO.
    ECHO.
    ECHO Too high, try again
    ECHO.
    ECHO.
    
    PAUSE
  )
IF %1 LSS %1% (
    CLS
    ECHO.
    ECHO.
    ECHO Too low, try again
    ECHO.
    ECHO.
    
    PAUSE
  )
IF %1 EQU %1% (
    CLS
    ECHO.
    ECHO.
    ECHO You have decided to DELETE this directory's contents
    ECHO.
    ECHO.
    
    PAUSE
    CALL :DELETE
)
  )
IF %1 EQU %2% (
    CLS
    ECHO.
    ECHO.
    ECHO You have decided to RENAME this directory's file extensions all to *.bat
    ECHO.
    ECHO.
    CALL :RENAME
    
    PAUSE
)
  )
IF %1 EQU %3% (
    CLS
    ECHO.
    ECHO.
    ECHO You have decided to EXIT
    ECHO.
    ECHO.
    CALL :EXIT
    
    PAUSE
)
:DELETE
del *.*
GOTO :EXIT
:RENAME
     REN *.* *.bat
     GOTO :EXIT
 
:EXIT
     exit
0

)
:DELETE
del *.*
GOTO :EXIT


ABOVE: it seems an emoticon jumped in there that is supposed to be CALL : DELETE (w/o the space)

0

I am on the road and do not have access to a compilier so forgive any obvious errors.

Several things I have to point out:

  • Although this is shell scripting, it's certainly Windows, and not Linux. And since I'm running Linux/BSD, I can't test any modifications I make on the code, even if I could understand Windows shell scripting.
  • You don't need a compiler to run this code. COMMAND.EXE simply "interprets" the code, so there's no compilation necessary.

Since you may not get excessive help here in the Linux forum, you may want to ask a mod to move it for you to the appropriate forum (there's not one dedicated to Windows shell scripting, but I'm sure they know where to move it.)

ABOVE: it seems an emoticon jumped in there that is supposed to be CALL : DELETE (w/o the space)

This problem would go away if you used code tags. They're highly encouraged here, and to use them, you simply insert your code in between [code] and [/code]. And then your code will look nicely formatted, retaining indentation:

CALL:DELETE
0

Since you may not get excessive help here in the Linux forum, you may want to ask a mod to move it for you to the appropriate forum (there's not one dedicated to Windows shell scripting, but I'm sure they know where to move it.)

umm how do I find a mod?
:-)

0

I appreciate you comments on the code I am posting below....

Does it do what you want it to do? What kind of comments are you expecting?

And to prevent the :D's, use code tags. That will stop the :('s from happening.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.