home *** CD-ROM | disk | FTP | other *** search
- : TopLink
- :
- : Usage: TopLink {<drive>}
- :
- : TopLink installs symbolic links to all toplevel directories on all of the
- : given drives or on all harddisks if we got no parameter.
- :
-
- ifglobal UNIX {;} else {
- set nounix
- Unix ; # if Unix-Mode inactive, enable it
- }
-
- set drives $*
- ifempty drives {
- : Get all connected drives (without floppy A and B)
- alldrives => drives ; # all drives are displayed
- if 'A' in drives {
- cdr -2 drives => drives ; # no A and B
- }
- }
-
- if drives != "" {
- : initialisation
- cls
- rem TopLink
- rem
- rem TopLink installs links to the toplevel-directories of the harddisk.
- rem then you can use all partitions like one single filesystem. We now
- rem process the drives $drives.
- rem
- rem Please wait...
- rem
-
- unset line ; # formatted line of screen output
- set inline 0 ; # number of words in line
- pushd > NUL: ; # save old directory
-
- : process the next drive
- foreach drive in drives do
- cd $drive:/ > NUL: ; # go to toplevel-directory of drive
- files -256d => dirnames ; # directories without path to dirnames
- : process the next directory
- foreach currentdir in dirnames do
- files -dp $currentdir => currentpath
- if not exec "ln /$currentdir => oldlink" {
- ; # test, wether we have a link already
- ; # if yes, ask the user
- if oldlink = currentpath {
- continue; # it's the same anyway
- }
- beep
- printf "\ej\eY( "
- printf "\eL"
- printf "\eLDirectory /$currentdir found twice:"
- printf "\eL old: $oldlink"
- printf "\eL new: $currentpath"
- get "LOverwrite ? [J/N] " keypressed
- printf "\eM\eA\eM\eA\eM\eA\eM\eA\eM\ek"
- if keypressed = 'N' {
- continue ; # next directory
- }
- }
- ln /$currentdir $currentpath ; # install a new link
- printf "%14s" currentdir ==> currentdir; # format the output
- set line $line$currentdir; ; # and add an entry to line
- increment inline ; # one more
- if inline = "5" {
- rem $line;
- set inline 0
- unset line ; # outpput line
- }
- endfor ; # to the next directory
- endfor ; # next drive
-
- : last actions
- if line != "" {
- rem $line; ; # output one last line
- }
- popd > NUL: ; # go back to the starting dir
- rem
- rem Done.
- beep
- }
-
- iflocal nounix { ; # was Unix-mode inactive ?
- Nounix
- }
- quit
-