Java File Touch touch(FileFilter filter, File root, boolean recurse)

Here you can find the source of touch(FileFilter filter, File root, boolean recurse)

Description

touch

License

Open Source License

Declaration

public static void touch(FileFilter filter, File root, boolean recurse) 

Method Source Code

//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);
                }
            }
        }
    }
}

Related

  1. touch(File file)
  2. touch(File file)
  3. touch(File file)
  4. touch(File file)
  5. touch(File file, boolean createIfNeeded)
  6. touch(final File f)
  7. touch(final File f)
  8. touch(final File file)
  9. touch(final File file)