Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for file.cmd

(view source code of file.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.  
  8. parse arg SrvName BasePath dummy
  9. if dummy   <> '' then call Syntax
  10. if BasePath = '' then call Syntax
  11. if pos( '?', SrvName ) > 0 then call Syntax
  12.  
  13. myRc = NetEnumerate(NETFILE, 'fileInfo', SrvName, BasePath)
  14. if myRc <> '0' then do
  15. 	say 'Got error from NetEnumerate() ' myRc
  16. 	exit 9
  17. end
  18.  
  19. if fileInfo.count = 0 then do
  20. 	say 'No files open on the server'
  21. 	exit 0
  22. end
  23.  
  24. say 'Number of open file entries: ' fileInfo.count
  25. say
  26.  
  27. do i=1 to fileInfo.count
  28. 	say fileInfo.i.username fileInfo.i.id fileInfo.i.permissions fileInfo.i.num_locks fileInfo.i.pathname
  29. end
  30.  
  31. exit 0
  32.  
  33.  
  34. Syntax: procedure
  35. 	say
  36. 	say 'File'
  37. 	say 'Show who has opened specified file'
  38. 	say
  39. 	say 'Usage:  FILE  \\server_name  full_path_and_file_name'
  40. 	exit 1
  41. return
  42.  

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