Cut/Paste vs Copy messing up file

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I have a program that pulls files out of a zip file for processing. The
program has ran through tens of thousands of files without any problem.

I am on a new project where I use the same code to do essentially the same
thing and it works much of the time. But we are getting corrupted files
that don't seem corrupted a bunch of times. We couldn't figure out why some
files work fine and some didn't. We are using Winzip and all the users are
doing it the same way.

I have a FileWatcher watching a folder that these files are dropped into.
The first think I do is try to extract the necessary files. But when I have
the error, it is when trying to set up the instance of the class:

public class ZipFiles
{
// The ZipFile object is a Java object so you will need the Java
Libraries and you will need to reference vjslib library

public static void Extract(string zipFileName, string
destinationPath)
{
ZipFile zipfile = null;

try
{
zipfile = new ZipFile(zipFileName);
}
catch(Exception exc)
{
throw new Exception("File: " + zipFileName + " Corrupted ",
exc);
}
finally
{
if (zipfile != null)
{
zipfile.close();
}
else
System.GC.Collect();
}

As you can see, all I am doing is instantiating the ZipFile class and
passing the file. If it can't, it thows an exception.

The only thing we can determine is that if we copy the file into the folder,
it works fine.

If we drag the file directly to the folder, we get the error. When we drag
it we are doing a move and not a copy so it is a copy/paste.

I have now idea why a "Move" would fail and "Copy" would not. It is the
same file.

Any idea what could cause this?

Thanks,

Tom
 
Mark Rae said:
What is the actual error message...?
Not sure.

I just know that the zip file couldn't create the object but the file was
there, in both cases
I've seen this before - I believe it's a permissions issue. I'd suggest
that you inspect the permissions of files which have been copied and those
which have been moved...
What kind of permissions?

And why would they be different for a cut and pasted (moved) or just a
copied file.

The file (destination) would be the same. And it is the destination where I
am picking up the file.

Thanks,

Tom
 
Not sure.

This is really the very first point to check. And it seems you show this in
your "file corrupted" message so it should be easy to try again and see what
is the actual exception you get...
 
Mark Rae said:
What is the actual error message...?
Not sure, as only the exception path was taken at the time and only the
message that it was corrupted was displayed.

I am going to be checking this out more thoroughly this week.
I've seen this before - I believe it's a permissions issue. I'd suggest
that you inspect the permissions of files which have been copied and those
which have been moved...
Why would the permission of the file be different copied be different from
the drag and drop (or cut).

Thanks,

Tom
 
Back
Top