home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / COMPOUND.ZIP / scr / cp_bmps.js
Encoding:
JavaScript  |  1998-11-12  |  1.4 KB  |  72 lines

  1. //
  2. //    CpWin.js
  3. //+
  4. //    Copy tmp directory .BMP files to a storage.
  5. //    Assumes the .BMP files are in c:\tmp and c:\tmp\Windows
  6. //-
  7. //    rev 11/09/98 gls
  8. //
  9.  
  10.  
  11. // //////////////////////////////////////////////////
  12. function Show( pszText )
  13. {
  14.     WScript.Echo( pszText );
  15. }
  16.  
  17. // //////////////////////////////////////////////////
  18. function CopyTo( objStg, sStg, sFileSpec )
  19. {
  20.  
  21.  
  22. objStg.MkDir( sStg );    // make the directory needed!
  23.  
  24.  
  25. //
  26. //    Scan the dir for files
  27. //
  28. var objDir = WScript.CreateObject( "gstg.dir" )
  29.  
  30. objDir.Scan( sFileSpec );
  31. var    cFile = objDir.getFileCount();
  32.  
  33. for(iF=0; iF<cFile; iF++)
  34.     {
  35.     var sFile = objDir.getFile( iF );
  36.     var sFileRoot = objDir.getFileRoot( sFile );
  37.  
  38.     var sStream = sStg + "\\" + sFileRoot;
  39.  
  40.     Show( "Copy " + sFile + " - " + sStream );
  41.     objStg.CopyTo( sFile, sStream );
  42.     }
  43.  
  44.  
  45.  
  46.  
  47. }
  48. // //////////////////////////////////////////////////
  49. function DoIt( sFile )
  50. {
  51. var objStg = WScript.CreateObject( "gstg.core" )
  52.  
  53. objStg.Create( sFile );
  54.  
  55. objStg.MkDir( "\\tmp" );
  56.  
  57. CopyTo( objStg, "\\BmpsTmp", "c:\\tmp\\*.bmp" );
  58.  
  59. CopyTo( objStg, "\\BmpsWin", "c:\\tmp\\Windows\\*.bmp" );
  60.  
  61.  
  62. objStg.Close();
  63.  
  64. }
  65. // //////////////////////////////////////////////////
  66.  
  67. DoIt( "tmp.stg" );
  68.  
  69. // //////////////////////////////////////////////////
  70. // //////////////////////////////////////////////////
  71. // //////////////////////////////////////////////////
  72.