Here you can find the source of touch(FileFilter filter, File root, boolean recurse)
public static void touch(FileFilter filter, File root, boolean recurse)
//package com.java2s; /******************************************************************************* * Copyright (c) 2007 Red Hat, Inc. //from w w w . j av a 2 s . c om * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ import java.io.File; import java.io.FileFilter; import java.util.Date; public class Main { public static void touch(FileFilter filter, File root, boolean recurse) { if (filter.accept(root)) root.setLastModified(new Date().getTime()); if (recurse && root.isDirectory()) { File[] children = root.listFiles(); if (children != null) { for (int i = 0; i < children.length; i++) { touch(filter, children[i], recurse); } } } } }