001/* 002 * Copyright (C) 2014 The Guava Authors 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.google.common.io; 018 019import com.google.common.annotations.Beta; 020import com.google.common.annotations.GwtIncompatible; 021import com.google.j2objc.annotations.J2ObjCIncompatible; 022import java.nio.file.SecureDirectoryStream; 023 024/** 025 * Options for use with recursive delete methods ({@link MoreFiles#deleteRecursively} and {@link 026 * MoreFiles#deleteDirectoryContents}). 027 * 028 * @since 21.0 029 * @author Colin Decker 030 */ 031@Beta 032@GwtIncompatible 033@J2ObjCIncompatible // java.nio.file 034@ElementTypesAreNonnullByDefault 035public enum RecursiveDeleteOption { 036 /** 037 * Specifies that the recursive delete should not throw an exception when it can't be guaranteed 038 * that it can be done securely, without vulnerability to race conditions (i.e. when the file 039 * system does not support {@link SecureDirectoryStream}). 040 * 041 * <p><b>Warning:</b> On a file system that supports symbolic links, it is possible for an 042 * insecure recursive delete to delete files and directories that are <i>outside</i> the directory 043 * being deleted. This can happen if, after checking that a file is a directory (and not a 044 * symbolic link), that directory is deleted and replaced by a symbolic link to an outside 045 * directory before the call that opens the directory to read its entries. File systems that 046 * support {@code SecureDirectoryStream} do not have this vulnerability. 047 */ 048 ALLOW_INSECURE 049}