home *** CD-ROM | disk | FTP | other *** search
- *REM This batch file is Freeware, free to use and redistribute unmodified *
- *REM Jouni Miettunen * jon@stekt.oulu.fi * Oulu * Finland * Europe * 1992 *
-
- REM chmod aka unixlike interface to attrib
- REM Timestamp 15-Nov-1992
-
- break on^setlocal^unalias *
-
- REM Default actions and settings
- iff %#==0 then^attrib/p^goto end^endiff
- if %@substr[%1,1,1]==? goto info
- set arg=d^set atr=%@substr[%1,,1]
-
- REM Do we have arguments or a file? Change settings before re-setting them.
- iff "%atr" != "-" .and. "%atr" != "+" .and. "%atr" != "=" .and. not exist %1 then
- unset/q atr^goto work^endiff
- set arg=q
-
- :optiot
- set index=%@eval[%index+1]^set %@ascii[%@substr[%1,%index,1]]=1
- if %index lt %@eval[%@len[%1]-1] goto optiot^shift
-
- if "%[%@ascii[d]]"=="1" set arg=%arg%d
- if "%[%@ascii[p]]"=="1" set arg=%arg%p
- if "%[%@ascii[R]]"=="1" set arg=%arg%s
- if "%[%@ascii[v]]"=="1" set arg=%@substr[%arg,1]
- if "%[%@ascii[a]]"=="1" set atr=%atr%a
- if "%[%@ascii[h]]"=="1" set atr=%atr%h
- if "%[%@ascii[r]]"=="1" set atr=%atr%r
- if "%[%@ascii[s]]"=="1" set atr=%atr%s
- iff %@len[%atr]==1 then^unset atr^set arg=%@substr[%arg,1]^endiff
- iff %@ascii[%atr]==61 then^alias attrib `*attrib%1 -ahrs %3^*attrib %&`^set atr=+%@substr[%atr,1]^endiff
-
- :work
- attrib/%arg %atr %&>&>nul^goto end
-
- :info
- echo Usage: %@lower[%@name[%0]] [ [-|+|=] options ] filelist
- text
- - remove attributes
- + add attributes
- = set attributes
-
- a archive attribute
- h hidden attribute
- r read-only attribute
- s system attribute
-
- d modify also directory attributes
- p pause after each full screen
- R recursive
- v verbose
- ? info
-
- Without any options you see current attributes.
- endtext
-
- :end
- break off^quit
-