home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!matt.ksu.ksu.edu!news
- From: holland@matt.ksu.ksu.edu (Rich Holland)
- Newsgroups: alt.msdos.programmer
- Subject: Re: Need DOS batch help!
- Date: 13 Aug 1992 08:22:52 -0500
- Organization: Kansas State University
- Lines: 42
- Message-ID: <16dnncINNk4f@matt.ksu.ksu.edu>
- References: <92225.09262732BFPQ3@CMUVM.CSV.CMICH.EDU> <1992Aug12.141526.25165@athena.mit.edu>
- NNTP-Posting-Host: matt.ksu.ksu.edu
-
- chanh@athena.mit.edu (Chanh N. Vuong) writes:
-
- >>I having a problem writing a batch file. I need a batch file which will go
- >>to a c:\Temp directory and delete every file in the directory except for
- >>a file named gest.bat. The batch must be written in such a way they the
- >>user will not get a message asking Yes/No (Y/N) in response to deleting
- >>the files , which limits your use of wildcard deletes like del *.*.
- >>
- >DEL_TEMP.BAT:
- >@echo off
- >c:
- >cd \
- >cd temp
- >md tmp
- >copy gest.bat tmp
- >for %%a in (*.*) do del %%a
- >copy c:\temp\tmp\gest.bat .
- >del c:\temp\tmp\gest.bat
- >rd tmp
- >cd \
-
- This one's easier to follow:
-
- @echo off
- cd \temp
- attrib *.* -r > nul
- attrib gest.bat +r > nul
- echo y | del *.* > nul
- attrib gest.bat -r > nul
- cd \
-
- It just sets gest.bat to Read-Only, and erases everything else. (The
- first attrib command makes sure there's no other RO files out there..)
- If you're in DOS 5.0, you can also kill Hidden/System files easily like
- this...
-
-
- --
- Rich Holland | INTERNET: holland@matt.ksu.ksu.edu
- 419 Marlatt Hall | BITNET : holland@ksuvm
- Manhattan, KS 66506 | UUCP : ...rutgers!matt.ksu.ksu.edu!holland
- "Jesus saves...but Gretzky gets the rebound! He shoots! He scores!!"
-