|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
||||
|
||||
|
I Know this is a javascript post but i cant find a .bat /ms-dos fourm so i will post here, lol
i have a problem trying to delete all directories in a directory here is my code (its for a disk check-up/clean-up) Code:
@ECHO OFF STARTLOCAL COLOR 0A GOTO WELCOME :START CLS GOTO STARTCHECK :STARTCHECK ECHO Performing An Error Check On Your Directories... ECHO NOTE: Analyzing Only ECHO - SET origdir=%cd% SET origdrive= SET user=%userprofile% SET cook=%user%\Cookies SET temp=%user%\Local Settings\Temp SET TIFS=%user%\Local Settings\Temporary Internet Files SET SYST=%systemroot%\Temp GOTO CHECK :RESTCHECK ECHO All Checks Have Been Completed Successfully. PAUSE GOTO LICENCE :CHECK ECHO Atempting To Access: %systemdrive% %systemdrive% ECHO Atempting To Access: %cook% SET noteErrordir=%cook% & cd "%cook%" & IF NOT "%cd%"=="%user%\Cookies" SET ER=true ECHO Atempting To Access: %temp% SET noteErrordir=%temp% & cd "%temp%" & IF NOT "%cd%"=="%user%\Local Settings\Temp" SET ER=true ECHO Atempting To Access: %TIFS% SET noteErrordir=%TIFS% & cd "%TIFS%" & IF NOT "%cd%"=="%user%\Local Settings\Temporary Internet Files" SET ER=true ECHO Atempting To Access: %SYST% SET noteErrordir=%SYST% & cd "%SYST%" & IF NOT "%cd%"=="%systemroot%\Temp" SET ER=true GOTO RESTCHECK IF %ER%==true GOTO _ERROR IF NOT %ER%==true GOTO RESTCHECK :WELCOME CLS ECHO Hello %username%, ECHO - ECHO Thank You For Running The Disk Clean-up Created By Colton22, What This Files Does Is It Purges (Deletes) All Files That Were Created By Browsing The Internet and/or All Temporary Files Created and Left Over By Programs,ECHO These Folders Locations Are... ECHO - %userprofile%\Cookies ECHO - %userprofile%\Local Settings\Temp ECHO - %userprofile%\Local Settings\Temporary Internet Files ECHO - %systemroot%\Temp ECHO - %userprofile%\Desktop\Recycle Bin ECHO As Shown Above, All Information Is Extracted From The Following Information... ECHO Your Current Operating System: %OS% ECHO Your Current Domain Name: %userdomain% ECHO Your Current User Name: %username% ECHO Your System Root Directory: %systemroot% ECHO Your User Directory: %userprofile% ECHO To Move On PAUSE GOTO START :LICENCE PUSHD "%origdir%" md "Agreed_Users" cd "Agreed_Users" ATTRIB +H +R "..\Agreed_Users" cd "%userdomain%_%username%_%OS%" IF "%cd%"=="%origdir%\Agreed_Users\%userdomain%_%username%_%OS %" GOTO CONT CD "%origdir%" CLS ECHO Licence Agreement For Disk Clean-up Created By Colton22 ECHO NOTE: To Go To The Next Page Press The Space Bar ^[ SPACE ^] PAUSE MORE License.txt /E /P /T5 +3 ECHO - ECHO - ECHO End Of End-User Licence Agreement PAUSE GOTO checkagree :checkagree CLS ECHO NOTE: Next Step IS Case Sensitive SET /P doesuseragree?=If You Do Not Agree To The Licence Agreement, Type The Following "I Disagree", If You Agree To The Licence Agreement Just Shown Type The Following "I Agree" and Press Enter: IF NOT "%doesuseragree?%"=="I Agree" IF NOT "%doesuseragree?%"=="I Disagree" GOTO AGREE2 IF "%doesuseragree?%"=="I Agree" GOTO SETFILEFORAGREE IF "%doesuseragree?%"=="I Disagree" GOTO DIFFEXIT :AGREE2 SET /P doesagree2?=I^'m Sorry, I Couldn^'t Understand Your Last Statment, Would You Like To Try Again? ^(y=yes^|n=no^) IF NOT %doesagree2?%==Y IF NOT %doesagree2?%==N IF NOT %doesagree2?%==y IF NOT %doesagree2?%==n GOTO AGREE2 IF %doesagree2?%==y GOTO checkagree IF %doesagree2?%==Y GOTO checkagree IF %doesagree2?%==n GOTO DIFFEXIT IF %doesagree2?%==N GOTO DIFFEXIT :DIFFEXIT CLS ECHO Thanks For Running The Disk Clean-up By Colton22 pause exit :SETFILEFORAGREE PUSHD "%origdir%\Agreed_Users" MD "%userdomain%_%username%_%OS%" ATTRIB +H +R "%userdomain%_%username%_%OS%" POPD GOTO CONT :CONT POPD CLS GOTO _DELETE :_ERROR COLOR C0 ECHO An Error Has Occured While Accessing One Of The Above Directorys... ECHO - ECHO Please Make Sure You Have Access To This Directory and Run This File Again. PAUSE ECHO ON EXIT :_DELETE ECHO The Following Will Delete All Of Your Temporary Internet Files SET /P isoktodelete=Continue? ^(y=yes^|n=no^) IF NOT %isoktodelete%==N IF NOT %isoktodelete%==Y IF NOT %isoktodelete%==n IF NOT %isoktodelete%==y GOTO _DELETE IF %isoktodelete%==y GOTO _CONTDELETE IF %isoktodelete%==Y GOTO _CONTDELETE IF %isoktodelete%==n GOTO _DEFRAGA IF %isoktodelete%==N GOTO _DEFRAGA :_CONTDELETE CD %cook% IF %cd%==%cook% DEL *.* /S /Q CD %temp% CD ..\ IF %cd%=="%userprofile%\Local Settings" (RD /S /Q "Temporary Internet Files" "Temp" & MD "Temporary Internet Files" "Temp") CD %SYST% IF %cd%==%SYST% (CD ..\ & RD /S /Q "Temp" & MD "Temp") pause goto _DEFRAGA :_DEFRAGA CLS cd\ ECHO Defragmentor... ECHO - DEFRAG %cd% -A ECHO - GOTO ASK :_DEFRAG DEFRAG %cd% GOTO ENDSCREEN :ASK SET /P isoktodefrag=Do You Wish To Defrag? ^(y=yes^|n=no^) IF NOT %isoktodefrag%==n IF NOT %isoktodefrag%==y IF NOT %isoktodefrag%==Y IF NOT %isoktodefrag%==N GOTO ASK IF %isoktodefrag%==y GOTO _DEFRAG IF %isoktodefrag%==Y GOTO _DEFRAG IF %isoktodefrag%==n GOTO ENDSCREEN IF %isoktodefrag%==N GOTO ENDSCREEN :ENDSCREEN COLOR C0 CLS ECHO All Tasks Have Been Completed Except One (CHKDSK) SET /P isoktochkdsk=Complete The Last Task? ^(y=yes^|n=no^) IF NOT %isoktochkdsk%==y IF NOT %isoktochkdsk%==n IF NOT %isoktochkdsk%==Y IF NOT %isoktochkdsk%==N GOTO ENDSCREEN IF %isoktochkdsk%==y GOTO CKDK IF %isoktochkdsk%==Y GOTO CKDK IF %isoktochkdsk%==n GOTO END IF %isoktochkdsk%==N GOTO END :CKDK COLOR 0A CLS CHKDSK GOTO CHKASK :CHKASK ECHO If There Were Problems Found Would You Like To Fix Them?? ^(y=yes^|n=no^) SET /P isoktofixprobs= IF NOT %isoktofixprobs%==y IF NOT %isoktofixprobs%==n IF NOT %isoktofixprobs%==N IF NOT %isoktofixprobs%==Y GOTO CHKASK IF %isoktofixprobs%==y (CHKDSK /F /V & GOTO END) IF %isoktofixprobs%==Y (CHKDSK /F /V & GOTO END) IF %isoktofixprobs%==n GOTO END IF %isoktofixprobs%==N GOTO END :END ENDLOCAL COLOR 0A CLS ECHO All Problems Have Been Fixed, Thank You For Using Disk Clean-up By Colton22! PAUSE ECHO On EXIT I Want To Be Able To, Instead of doing... RD /S /Q "Temp" & MD "Temp" I Would Like To Do Something Similar To... DEL *.* /S /Q It Would Look Like This... RD /S /Q * *=Wildcard but it wont work that way it will say directory name "*" invalid can anyone help me?? Last edited by colton22 : August 1st, 2006 at 12:02 PM. Reason: Changed from quote to code |
|
#2
|
||||
|
||||
|
Not possible with normal DOS commando's, sorry.
You could write a special program or script for it, but in the end, it'd be more work than deleting the directory and recreating it, as you did. Quote:
We have the General Programming Help Forum for that ![]() I'll ask one of the mods to move this thread.
__________________
This is my code. Is it not nifty? "The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools." ---Douglas Adams Join the Itsacon fanclub! Zero Tolerance: Spammers banned so far: 264
![]() |
|
#3
|
||||
|
||||
|
alright thanks
colton22 |
|
#4
|
||||
|
||||
|
Well, I wasn't that helpful, but you're welcome ;-)
|
|
#5
|
||||
|
||||
|
We also recommend you wrap your code fragments in [code][/code] tags when posting to the forums... the quote tags are a start, but code is better
![]()
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter! DevArticles Forum Moderator "The net is a waste of time, and that's exactly what's right about it." -- William Gibson |
|
#6
|
||||
|
||||
|
I was about to ask why you hadn't moved this thread yet, but then I saw you have no power here. Only ChiefWigs has...
Last edited by Itsacon : August 1st, 2006 at 08:59 AM. |
|
#7
|
||||
|
||||
|
well i learned something new, with the code tags, thanks
|
|
#8
|
||||
|
||||
|
also i couldnt help but notice..
Itsacon Command Line Warrior Join Date: Aug 2004 Location: Sector ZZ9 Plural Z Alpha Posts: 666 Time spent in forums: 4 Days 9 h 25 m 2 sec Reputation Power: 2 nice amount of posts lol ![]() colton22 |
|
#9
|
||||
|
||||
|
Yeah. I'm evil, I know...
|
|
#10
|
||||
|
||||
|
ha, yea, i have 2 more probs though, there posted in general, it all deals with adding to var's together to equal the name of another var and then call the new var's name, it's explained
colton22 ps thx again |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Problem in Batch/MS-DOS scripting |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|