Java - COPIAR ARCHIVO MANTENIENDO FECHA DE ORIGEN

 
Vista:

COPIAR ARCHIVO MANTENIENDO FECHA DE ORIGEN

Publicado por Eduardo (19 intervenciones) el 07/06/2007 14:48:50
QUE TAL:

NECESITO COPIAR ARCHIVOS MANTENIENDO LA FECHA DE ORIGEN.

HOY ESTOY UTILIZANDO LA SIGUIENTE SECUENCIA PERO EL ARCHIVO COPIADO APARECE CON UNA FECHA DISTINTA AL ORIGINAL.


FileInputStream fis = new FileInputStream(archivo_a_modificar);

Archivo=directorioDestinoTTA+nombre;

File Archi = new File(Archivo);

FileOutputStream fos = new FileOutputStream(Archi);

FileChannel canalFuente = fis.getChannel();

FileChannel canalDestino = fos.getChannel();

canalFuente.transferTo(0, canalFuente.size(), canalDestino);

fos.close();


BUSCANDO INFORMACION ENCONTRE LO SIGUIENTE, PERO NO SE COMO EJECUTARLO PARA QUE ME MANTENGA LA MISMA FECHA EL ARCHIVO COPIADO, NO SE SI DENTRO DE LA CLASE HAY QUE PONER ALGO O SOLO CON ESO ANDA

copyFile
public static void copyFile(File srcFile,
File destFile)
throws IOExceptionCopies a file to a new location preserving the file date.
This method copies the contents of the specified source file to the specified destination file. The directory holding the destination file is created if it does not exist. If the destination file exists, then this method will overwrite it.

GRACIAS !!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder