Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for lhomedir.cmd

(view source code of lhomedir.cmd as plain text)

  1. /* Restore local home directory shares */
  2.  
  3. /* Initialize RexxUtil */
  4. if RxFuncQuery( "SysFileTree" ) <> 0 then do
  5. 	call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  6. 	call SysLoadFuncs
  7. end
  8.  
  9. /* Do not display external commands */
  10. "@ECHO OFF"
  11.  
  12. /* Check and interpret command line parameter */
  13. parse upper arg drive":\"homedir_path dummy
  14. if dummy          <> "" then call Syntax
  15. if drive           = "" then call Syntax
  16. if length( drive ) <> 1 then call Syntax
  17. if homedir_path    = "" then call Syntax
  18.  
  19. /* Read a list of all home directories */
  20. homedir_path = strip( homedir_path, "T", "\" )
  21. homedirs     = drive||":\"||homedir_path||"\*"
  22. call SysFileTree homedirs, "homedir.", "DO"
  23. if homedir.0 < 1 then do
  24. 	call Syntax "NoDirs"
  25. end
  26. else do i = 1 to homedir.0
  27. 	backslash  = lastpos( "\", homedir.i )
  28. 	share_name = substr( homedir.i, backslash + 1 )
  29. 	commando = "NET SHARE "||share_name||"="||drive||":\"
  30. 	commando = commando||homedir_path||"\"||share_name
  31. 	address CMD commando
  32. end
  33. EXIT 0
  34.  
  35.  
  36. Syntax:
  37. 	param = translate( arg( 1 ) )
  38. 	call SysCls
  39. 	say
  40. 	say "LHOMEDIR,  Version 1.01"
  41. 	say "(C) 1999, Rob van der Woude"
  42. 	say
  43. 	say "Locally restore the shares of all home directories."
  44. 	say "Should be run from the console of the home"
  45. 	say "directories server."
  46. 	say
  47. 	say "Use RHomeDir if you want to restore remote shares."
  48. 	say
  49. 	if param = "NODIRS" then do
  50. 		say "No subdirectories found in"
  51. 		say drive||":\"||homedir_path
  52. 		say
  53. 	end
  54. 	say "Usage:  LHOMEDIR  <homedir_path>"
  55. 	say
  56. 	say "where <homedir_path> is the directory containing"
  57. 	say "the home directories"
  58. 	EXIT 1
  59. return
  60.  

page last modified: 2024-04-16; loaded in 0.0267 seconds