Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for files.cmd

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

  1. /* List open files on server */
  2.  
  3. call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
  4. call LoadLsRxutFuncs
  5.  
  6. NETFILE  = 60
  7. BasePath = 'D:\'
  8.  
  9. parse arg SrvName UserId dummy
  10. if dummy <> '' then call Syntax
  11. if UserId = '' then call Syntax
  12. if pos( '?', SrvName ) > 0 then call Syntax
  13.  
  14. myRc = NetEnumerate(NETFILE, 'fileInfo', SrvName, BasePath, UserId)
  15. if myRc <> '0' then do
  16. 	say 'Got error from NetEnumerate() ' myRc
  17. 	exit 9
  18. end
  19.  
  20. if fileInfo.count = 0 then do
  21. 	say 'No files open on the server'
  22. 	call DropLsRxutFuncs
  23. end
  24.  
  25. say 'Number of open file entries: ' fileInfo.count
  26. say
  27.  
  28. do i=1 to fileInfo.count
  29. 	say fileInfo.i.id fileInfo.i.permissions fileInfo.i.num_locks fileInfo.i.pathname
  30. end
  31. exit 0
  32.  
  33.  
  34. Syntax: procedure
  35. 	say
  36. 	say 'Files'
  37. 	say "Show all open files on server's D: drive for specified user ID"
  38. 	say
  39. 	say 'Usage:  FILES  \\server_name  user_id'
  40. 	exit 1
  41. return
  42.  

page last uploaded: 2016-12-15, 11:20