Hey

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.
http://docs.oracle.com/javase/tutorial/essential/io/fileio.html

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.