home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / batnmore.z!p / RM.BTM < prev   
Text File  |  1992-11-15  |  1KB  |  45 lines

  1. *REM This batch file is Freeware, free to use and redistribute unmodified *
  2. *REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
  3.  
  4. REM Unixish interface to del command
  5. REM Timestamp 15-Nov-1992
  6.  
  7. break on^setlocal^unalias *^if %#==0 .or. "%1"=="-?" goto info^set arg=qy
  8.  
  9. REM Did the user give any arguments? Is it argument or a file?
  10.  
  11. if "%@ascii[%1]" != "45" .or. exist %1 .or. isdir %1 goto over
  12. if "%2"=="" goto info
  13.  
  14. :optiot
  15. set index=%@eval[%index+1]^set %@ascii[%@substr[%1,%index,1]]=1
  16. if %index lt %@eval[%@len[%1]-1] goto optiot^shift
  17.  
  18. if "%[%@ascii[r]]"=="1" set arg=%arg%xsy
  19. if "%[%@ascii[f]]"=="1" set arg=%arg%z
  20. if "%[%@ascii[i]]"=="1" set arg=%arg%p
  21. if "%[%@ascii[v]]"=="1" set arg=%@substr[%arg,1]
  22.  
  23. :over
  24. if "%1"=="" goto end^set do=%1^gosub work^shift^goto over
  25.  
  26. :work
  27. REM Note: verbose doesn't work for removing subddirs, but I don't know why..
  28.  
  29. del /%arg %do >&>nul || echo Error: cannot remove "%do"^return
  30.  
  31. :info
  32. echo %@lower[%@name[%0]] [-options] file | directory ...
  33. text
  34.  
  35.     -f    Force removal (hidden/read-only/system)
  36.     -i    Interactive: ask permission before removing
  37.     -r    Recursive removal (only normal files in subdirs)
  38.     -v    Verbose: tell what's happening
  39.     -?    Help
  40. endtext
  41. goto end
  42.  
  43. :end
  44. break off^quit
  45.