Java Folder Read getFilesCannotAccess(File... files)

Here you can find the source of getFilesCannotAccess(File... files)

Description

Given a list of files, returns all the files which exist and that the process can't write to.

License

Open Source License

Declaration

public static List<File> getFilesCannotAccess(File... files) 

Method Source Code

//package com.java2s;

import java.io.File;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**//from   www.  ja  v  a  2s .  c o m
     * Given a list of files, returns all the files which exist and that the
     * process can't write to.
     */
    public static List<File> getFilesCannotAccess(File... files) {
        ArrayList<File> failAccess = new ArrayList<File>();
        for (File file : files) {
            if (file.exists() && !file.canWrite()) {
                failAccess.add(file);
            }
        }
        return failAccess;
    }

    public static boolean exists(String fileName) {
        File file = new File(fileName);

        return file.exists();
    }
}

Related

  1. getFilesByName(File path, String name)
  2. getFilesByPath(String toDir)
  3. getFilesByRegxFileName(String dir, final String regxName)
  4. getFilesByType(String fileType, String path)
  5. getFilesByType(String path, final String type)
  6. getFilesComposingPath(File aFile)
  7. getFilesCount(File archiveFile)
  8. getFileset(File projectFolder)
  9. getFilesFolder(String path)