Java File Name Get getFileNameUtil(String dataPath)

Here you can find the source of getFileNameUtil(String dataPath)

Description

get File Name Util

License

Apache License

Declaration

public static ArrayList<String> getFileNameUtil(String dataPath) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.util.ArrayList;

public class Main {
    public static ArrayList<String> getFileNameUtil(String dataPath) {
        ArrayList<String> fileName = new ArrayList<>();
        File file = new File(dataPath);
        File[] files = file.listFiles();
        if (files != null) {
            for (File file1 : files) {
                if (file1.isDirectory()) {
                    getFileNameUtil(file1.getPath());
                } else {
                    fileName.add(file1.getName());
                }//from w  ww .  j a v  a2s.  c  o  m
            }
        }
        return fileName;
    }
}

Related

  1. getFileNamesInJar(File source, String folder, String extension)
  2. getFileNamesOld(File zipFile)
  3. getFileNamesRecursive(final String pDataDir, final FilenameFilter pFilter, final int pMaxFiles)
  4. getFileNameStartingWith(String directory, String prefix)
  5. getFilenameSuffix(final File file)
  6. getFileNameWithAddedExtension(File parent, File f, String ext)
  7. getFileNameWithNewExtension(File parent, File file, String ext)
  8. getFilenameWithoutAnyExtension(File file)
  9. getFileNameWithoutExt(File file)