home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / alt / msdos / programm / 2191 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  1.7 KB

  1. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!matt.ksu.ksu.edu!news
  2. From: holland@matt.ksu.ksu.edu (Rich Holland)
  3. Newsgroups: alt.msdos.programmer
  4. Subject: Re: Need DOS batch help!
  5. Date: 13 Aug 1992 08:22:52 -0500
  6. Organization: Kansas State University
  7. Lines: 42
  8. Message-ID: <16dnncINNk4f@matt.ksu.ksu.edu>
  9. References: <92225.09262732BFPQ3@CMUVM.CSV.CMICH.EDU> <1992Aug12.141526.25165@athena.mit.edu>
  10. NNTP-Posting-Host: matt.ksu.ksu.edu
  11.  
  12. chanh@athena.mit.edu (Chanh N. Vuong) writes:
  13.  
  14. >>I having a problem writing a batch file.  I need a batch file which will go
  15. >>to a c:\Temp directory and delete every file in the directory except for
  16. >>a file named gest.bat.  The batch must be written in such a way they the
  17. >>user will not get a message asking Yes/No (Y/N) in response to deleting
  18. >>the files , which limits your use of wildcard deletes like del *.*.
  19. >>
  20. >DEL_TEMP.BAT:
  21. >@echo off
  22. >c:
  23. >cd \
  24. >cd temp
  25. >md tmp
  26. >copy gest.bat tmp
  27. >for %%a in (*.*) do del %%a
  28. >copy c:\temp\tmp\gest.bat .
  29. >del c:\temp\tmp\gest.bat
  30. >rd tmp
  31. >cd \
  32.  
  33. This one's easier to follow:
  34.  
  35. @echo off
  36. cd \temp
  37. attrib *.* -r > nul
  38. attrib gest.bat +r > nul
  39. echo y | del *.* > nul
  40. attrib gest.bat -r > nul
  41. cd \
  42.  
  43. It just sets gest.bat to Read-Only, and erases everything else.  (The
  44. first attrib command makes sure there's no other RO files out there..) 
  45. If you're in DOS 5.0, you can also kill Hidden/System files easily like
  46. this...
  47.  
  48.  
  49. -- 
  50. Rich Holland             | INTERNET:  holland@matt.ksu.ksu.edu
  51. 419 Marlatt Hall         | BITNET  :  holland@ksuvm
  52. Manhattan, KS  66506     | UUCP    :  ...rutgers!matt.ksu.ksu.edu!holland
  53. "Jesus saves...but Gretzky gets the rebound!  He shoots!  He scores!!"
  54.