Free Java Utility To Touch Files (Cross Platform) Java libre de utilidad para tocar archivos (multiplataforma)
This is a simple commandline Java utility which I wrote down in under 5 minutes to help in checking-in (svn commit) over 500 files which were modified but the dates weren't changed due to an error in our settings. Se trata de una simple utilidad de comandos de Java que he escrito en menos de 5 minutos para ayudar en el control-a (svn cometer) más de 500 archivos que se modificaron las fechas pero no se cambió debido a un error en nuestra configuración. So subversion failed to recognize it. Así que la subversión no reconocerlo. Anyway this simple utility updates the timestamp of any file(s) and directories recursively to current time . De todas formas esta sencilla utilidad actualiza la fecha y hora de cualquier archivo (s) y directorios recursivamente a la hora actual. It is extremely fast and cross-platform. Es extremadamente rápido y multiplataforma. It does one job and does it well. Hace un trabajo y lo hace bien. It is named after the unix utility touch , with similar functionality. Es el nombre de la utilidad unix tacto, con una funcionalidad similar.
import java.io.File; /** Super-fast file / directory(recursive) touch. importación java.io.File; / ** Super-rápido archivo / directorio (recursivo) tacto. * It doesn't ask for confirmation. * No se solicitará su confirmación. * Arguments: File / Directories to touch to current time. * Argumentos: Archivo / Directorios tocar al momento actual. */ public class Touch { public static void main(String ... args) { long time = System.currentTimeMillis(); for(String fileName:args) touch(new File(fileName), time); } /** Recursively touch file and directories. * / Public class Touch (public static void main (String ... args) (mucho tiempo = System.currentTimeMillis (); (String Nombre de archivo: args) toque (nuevo archivo (nombre de archivo), tiempo);) / ** recurrentemente toque el archivo y directorios. * @param File (file or directory) for touching. * @ Param File (fichero o directorio) para tocar. */ public static void touch(File file, long time) { if(file.isDirectory()) for(File childFile:file.listFiles()) touch(childFile, time); file.setLastModified(time); } } * / Public static void tocar (Archivo archivo, mucho tiempo) (if (file.isDirectory ()) para (Archivo childFile: file.listFiles ()) touch (childFile, tiempo); file.setLastModified (tiempo);))
You can also download the También puede descargar el java executable class file Java clase de archivo ejecutable . You can run it as follows: Se puede ejecutar como sigue:
java -classpath . java-classpath. Touch *.html Touch *. html
Replace *.html with file name(s) and directories you want to update. Sustituir *. html con el nombre del archivo (s) y directorios que quieras actualizar. This requires JDK 1.5 or later. Para ello se requiere JDK 1,5 o posterior.
Filed under Filed under Headline News Headline News , How To Cómo , Java Software El software de Java , Tech Note Nota técnica | |
| |
RSS 2.0 RSS 2,0 | |
Trackback this Article | este artículo |
Email this Article Enviar artículo
You may also like to read También puede leer |




































March 17th, 2007 at 7:13 am 17 de Marzo, 2007 a las 7:13 am
There’sa problem with the recursinion in the touch method. Hay un problema con el recursinion en el método de contacto.
This line: Esta línea:
if(file.isDirectory()) for(File childFile:file.listFiles()) touch(file, time); if (file.isDirectory ()) para (Archivo childFile: file.listFiles ()) touch (archivo, tiempo);
should be: deberían ser:
if(file.isDirectory()) for(File childFile:file.listFiles()) touch(childFile, time); if (file.isDirectory ()) para (Archivo childFile: file.listFiles ()) touch (childFile, tiempo);
July 5th, 2007 at 8:00 am 5 de julio de 2007, a las 8:00 am
Thanks. Gracias. Corrected. Corregido.
November 27th, 2007 at 1:29 pm 27 de noviembre de 2007, a las 1:29 pm
Thanks for this little utility! Gracias por esta pequeña utilidad!
It would be nice if you could also correct the class file.. Sería bueno que usted también puede corregir el archivo de clase ..