Foros del Web » Programación para mayores de 30 ;) » Java »

Copiar Archivo Manteniendo La Fecha De Origen

Estas en el tema de Copiar Archivo Manteniendo La Fecha De Origen en el foro de Java en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 07/06/2007, 07:14
 
Fecha de Ingreso: abril-2007
Mensajes: 31
Antigüedad: 17 años
Puntos: 0
Copiar Archivo Manteniendo La Fecha De Origen

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 !!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:00.