1 Reply Latest reply on Jan 30, 2012 5:39 AM by கற்பனை (Imagine)

    compressed (zipped) folders error

    nilamk

      When i use script

       

       

       

       

                  var sourceNo=1;

                    var sCreateZipScript = "Const FOF_SIMPLEPROGRESS = 256\r"

                    sCreateZipScript += "Dim source, destination, hexVal, binaryVal, i\r"

                    sCreateZipScript += "Dim oShell, oCTF\r"

                    sCreateZipScript += "Dim oFileSys\r";

                    sCreateZipScript += "dim winShell\r";

       

                    var filesinfolder = source.getFiles("*");

                      var a= filesinfolder.length;

                      for(var j = 0; j < filesinfolder.length; j++)

                      {

                            sCreateZipScript += "source"+sourceNo+"=";

                            sCreateZipScript += "\""+filesinfolder[j].fsName+"\"\r"                    //Get the platform dependent string.

                            sourceNo++;    

                      }

       

       

                    sCreateZipScript += "destination = "

                    sCreateZipScript += "\""+zipFilePath.fsName+"\"\r"

                    sCreateZipScript += "hexVal = Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0)\r";

                    sCreateZipScript += "For i = 0 To UBound(hexVal)\r";

                    sCreateZipScript += "binaryVal = binaryVal & Chr(hexVal(i))\r";

                    sCreateZipScript += "Next\r";

                    sCreateZipScript += "Set oShell = CreateObject(\"WScript.Shell\")\r";

                    sCreateZipScript += "Set oFileSys = CreateObject(\"Scripting.FileSystemObject\")\r";

                    sCreateZipScript += "'Create the basis of a zip file.\r";

                    sCreateZipScript += " Set oCTF = oFileSys.CreateTextFile(destination, True)\r";

                    sCreateZipScript += " oCTF.Write binaryVal\r";

                    sCreateZipScript += " oCTF.Close\r";

                    sCreateZipScript += " Set oCTF = Nothing\r";

                    sCreateZipScript += "'Add File to zip\r";

                    sCreateZipScript += " set winShell = createObject(\"shell.application\")\r";

                    sourceNo=1;

                     for(var j = 0; j < filesinfolder.length; j++)

                     {

                          sCreateZipScript += " winShell.namespace(destination).CopyHere source"+sourceNo+"\r"; 

                          sourceNo++; 

                     }

       

       

                    app.doScript(sCreateZipScript, ScriptLanguage.visualBasic);

                    return Number(app.scriptArgs.getValue("ScriptArgumentA"));

       

       

      It creats zip file but only few files can be zipped. And it gives error alert that is "compressed (zipped) folders error " with alert message is " File not found or no read permision".

      But all file are present in source folder.

       

      Screen Shot:-

       

           Untitled.png