Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for allfiles.cmd

(view source code of allfiles.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 dummy
  10. if dummy  <> '' then call Syntax
  11. if SrvName = '' then call Syntax
  12. if pos( '?', SrvName ) > 0 then call Syntax
  13.  
  14. myRc = NetEnumerate(NETFILE, 'fileInfo', SrvName, BasePath)
  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. 	exit 0
  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 fileInfo.i.username
  30. end
  31.  
  32. exit 0
  33.  
  34.  
  35. Syntax: procedure
  36. 	say
  37. 	say 'AllFiles'
  38. 	say 'Show all open files on specified server'
  39. 	say
  40. 	say 'Usage:  ALLFILES  \\server_name'
  41. 	exit 1
  42. return
  43.  

page last uploaded: 2017-04-06, 13:33