Java Folder Read getFilesComposingPath(File aFile)

Here you can find the source of getFilesComposingPath(File aFile)

Description

Get the list of all File objects that compose the path to the given File object

License

Open Source License

Parameter

Parameter Description
aFile the file whose path must be retrieved.

Return

a List with all the File objects that compose the path to the given File object.

Declaration

public static List<File> getFilesComposingPath(File aFile) 

Method Source Code


//package com.java2s;
import java.io.File;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**//from  w w  w.java2 s  .  c om
     * Get the list of all File objects that compose the path to the given File object
     * 
     * @param aFile the file whose path must be retrieved.
     * @return a List with all the File objects that compose the path to the given File object.
     */
    public static List<File> getFilesComposingPath(File aFile) {
        List<File> fileList;

        if (aFile == null) {
            fileList = new ArrayList<File>();
        } else {
            fileList = getFilesComposingPath(aFile.getParentFile());
            fileList.add(aFile);
        }

        return fileList;
    }
}

Related

  1. getFilesByPath(String toDir)
  2. getFilesByRegxFileName(String dir, final String regxName)
  3. getFilesByType(String fileType, String path)
  4. getFilesByType(String path, final String type)
  5. getFilesCannotAccess(File... files)
  6. getFilesCount(File archiveFile)
  7. getFileset(File projectFolder)
  8. getFilesFolder(String path)
  9. getFilesFor(List patientSets, File inputDirectory)