home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / COMPOUND.ZIP / scr / stg / copyto.js < prev    next >
Encoding:
JavaScript  |  1998-11-12  |  1.2 KB  |  65 lines

  1. //
  2. //    CopyTo.js
  3. //+
  4. //    Copy a file (this file) to a structured file in various locations
  5. //-
  6. //    rev 11/01/98 gls
  7. //
  8.  
  9.  
  10. // //////////////////////////////////////////////////
  11. function Show( pszText )
  12. {
  13.     WScript.Echo( pszText );
  14. }
  15.  
  16. // //////////////////////////////////////////////////
  17. function CopyTo( sFile )
  18. {
  19. var objStg = WScript.CreateObject( "gstg.core" )
  20.  
  21.  
  22. objStg.Open( sFile );        // assumed already created
  23.  
  24. objStg.MkDir( "\\tmp" );    // a sub-storage for copy to
  25.  
  26.  
  27. //
  28. //    file to stream
  29. //
  30. objStg.CopyTo( "copyto.js", "copyto.js" );
  31. objStg.CopyTo( "copyto.js", "copy2.js" );
  32.  
  33.  
  34. //
  35. //    file to sub-storage
  36. //
  37. objStg.CopyTo( "copyto.js", "\\tmp" );
  38.  
  39.  
  40. //
  41. //    file to sub-storage\stream
  42. //
  43. objStg.CopyTo( "copyto.js", "\\tmp\\copy2x.js" );
  44. objStg.CopyTo( "copyto.js", "\\tmp\\copy3x.js" );
  45.  
  46.  
  47. for(iF=0; iF<10; iF++)
  48.     {
  49.     var sFileDes = "\\tmp\\copyOfFile" + iF + ".tmp";
  50.     Show( sFileDes );
  51.     objStg.CopyTo( "copyto.js", sFileDes );
  52.     }
  53.  
  54.  
  55. objStg.Close();
  56.  
  57. }
  58. // //////////////////////////////////////////////////
  59.  
  60. CopyTo( "tmp.stg" );
  61.  
  62. // //////////////////////////////////////////////////
  63. // //////////////////////////////////////////////////
  64. // //////////////////////////////////////////////////
  65.