home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Misc / generateUpdate.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  2.0 KB  |  69 lines

  1. !!Script
  2. // Copyright ⌐ 1999 - Modelworks Software
  3.  
  4. /**
  5. @Tool: generateUpdate~copies all files in the current IDE 
  6. folder that are newer than a given date to a Update folder
  7. suitable for archiving using WinZip which in turn can be
  8. used to update other copies of the IDE.
  9. @EndTool: 
  10. @Summary: generateUpdate~generates a folder that can be used to update other copies 
  11. */
  12.  
  13. var gUpdateDirectory = "C:\\IDEUpdate"; // Define a folder for the updated files
  14. var gDate = new Date(1998,8,19).getTime(); // Select a date
  15.  
  16. var gOutput = getOutput();
  17. var gIDEDirectory = File.getApplicationPath();
  18.  
  19. function DoCommand()
  20. {
  21.     gOutput.writeLine("Generate Update\n");
  22.  
  23.     if (gIDEDirectory)
  24.     {
  25.         ProcessDirectory(gIDEDirectory);
  26.     }
  27.     
  28.     gOutput.writeLine("Finished\n");
  29. }
  30.  
  31. function ProcessDirectory(directory)
  32. {
  33.     if (directory)
  34.     {
  35.         gOutput.writeLine("Processing directory: " + directory);
  36.         
  37.         var fileList = getDirectoryFiles(directory, "*.*", false);
  38.         if (fileList)
  39.         {
  40.             var position = fileList.getHeadPosition();
  41.             while (position && position.valid)
  42.             {
  43.                 var file = fileList.getNext(position);
  44.                 var path = file.path;
  45.                 if(path.length > gIDEDirectory.length && file.lastModified >= gDate)
  46.                 {
  47.                     var newPath = gUpdateDirectory + path.substring(gIDEDirectory.length, path.length);
  48.                     file.copyTo(newPath, false)
  49.                 }
  50.             }
  51.         }
  52.     
  53.         var directoryList = getDirectories(directory);
  54.         if (directoryList)
  55.         {
  56.             directoryList.sort(compareFiles);
  57.             var position = directoryList.getHeadPosition();
  58.             while (position && position.valid)
  59.             {
  60.                 var directoryFile = directoryList.getNext(position);
  61.                 ProcessDirectory(directoryFile.path);
  62.             }
  63.         }
  64.     }
  65. }
  66.  
  67. !!/Script
  68.  
  69.