zZipFiles("R", OutFileName, "*.*", "") always fails with 3 Err?

Started by IJRobson, May 16, 2014, 11:36:40 AM

Previous topic - Next topic

IJRobson

Code (winbatch) Select
DirChange(ResFolder)
Zip = zZipFiles("R", OutFileName, "*.*", "")


DebugTrace reports:

(9313) VALUE STRING => "3      zip warning: missing end signature--probably not a zip file (did you      zip warning: remember to use binary mode when you transferred it?)      zip warning: (if you are trying to read a damaged archive try -F)      zip error: Zip file structure invalid (c:/Temp/FR495.tmp)   "

OutFileName is "c:/Temp/FR495.tmp" which is always 0 length?
ResFolder contains a Text file which is accessible and I can ZIP it with WinZIP just not zZIPFiles?

I am run Extender 44012 with WinBatch 2014A

Any Ideas?

td

Other than checking your ResFolder variable's contents, no ideas.  The function works just fine when tested with the "R" option and there are no other known user reported problems.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

IJRobson

ResFolder is "c:\Temp\FR495\" in this case and this folder contains a Text File called no "Command Status.dat" which was created by this program just before the zZipFiles command.  I have checked this File Exists, it contains information and has been closed by this stage.

I will investigate further.

Thanks

IJRobson

I can't explain this but this morning everything is working fine?

I have not changed anything, I am running the same compiled EXE as I did on Friday.

The only thing I can think of that has changed is the values of ResFolder.  I use FileCreateTemp as the ZIP file Name and create a Directory with the same FileRoot to place the file to ZIP.

In Fridays example they were "C:\Temp\FR495.tmp" and "C:\Temp\FR495\".

This morning is was "C:\Temp\FR4A7.tmp" and "C:\Temp\FR4A7\".

Code (winbatch) Select
Zip = zZipFiles("R", OutFileName, "*.*", "")
(5219) VALUE STRING => "0   adding: COMMAND STATUS.DAT (188 bytes security) (deflated 4%)"


IJRobson

I have determined why I get a Error 3:

If you try to create a ZIP file and the ZIP file already exists (0 bytes) then you get this error as it is trying to open this ZIP file as a valid ZIP file.

This produces the "missing end signature--probably not a zip file" error.

So the question why did the ZIP file already Exist?

I use FileCreateTemp to obtain a new Temp File Name but then Delete this File.

Code (winbatch) Select
OutFileName = FileCreateTemp("FR")         ; Creates a temporary file.

If FileExist(OutFileName) then
FileDelete(OutFileName)
Endif


The time this has failed (Friday) it appears the Temp File was not deleted?  So either the File was not seen or the Delete Failed?

td

Most likely cause is faulty logic someplace in your script but the snippet you posted isn't very useful in determining whether or not that is the case. Just because a file exists doesn't mean you can successfully delete it.  You wouldn't by chance be attempting to debug this problem with ErrorMode set to '@off'?

And yes, an error stating that a file isn't likely a proper zip file is a good indicator that a file isn't likely a proper zip file.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

IJRobson

The EXE I was running Friday only had Debug Switched ON for the ZIP related area of the code.  So this Trace information does not contain the status of the FileExist or FileDelete Commands.

Whilst trying to investigate further I played around with zZipFiles and managed to produce the Error if the ZIP file was 0 size when zZipFiles was called so I am presuming that was the cause and as there is no branched code relating to the Creation of OutFileName and it being used this sounds like a reasonable cause.

I have tried to repeat the Problem today but everything is working fine.

I have now updated my code to better check and report on the FileDelete stage so if I get this problem again then I should have some information to confirm the Problem.

One thing I was thinking was if the Virus Checker could be involved as I know we have had problems in the past when accessing the files in the TEMP folder.  Although still no idea why the Problem has gone again.  Of cause Windows or some application could have crashed that a Power Cycle has fixed?

Anyway unless I can repeat the problem I may never know.

Thanks for the Help.