I am having problems making a exact copy of a file. It seems that it changes the headers of the file.

I tried using the Apache fileutils copyfile method but it seems to change the header completely. The rest of the file looks pretty much OK.

I think it works but the problem is that the FTP transfer fails.......It generates the copy correctly I think

Any way to do it?

See what James has posted, check the java tutorials.

Typical roseindia - hardly an expert solution, and more important to this thread, does nothing about the file headers.
riahc3 - have you had a look at the NIO (new I/O) classes in Java 7? They have lots of new stuff for copying files and handing file attributes - even OS-dependent headers.

See especially Files.copy(source, target, COPY_ATTRIBUTES);

I'm using Java 6 but I solved it: had to set the file type to binary instead of the default of ASCII. My fault.

commented: In every thread of yours, you find the solution at the very end yourself!. :P +4