com.cloudera.sqoop.util
Class FileListing

java.lang.Object
  extended by com.cloudera.sqoop.util.FileListing

public final class FileListing
extends java.lang.Object

Recursive file listing under a specified directory. Taken from http://www.javapractices.com/topic/TopicAction.do?Id=68 Used under the terms of the CC Attribution license: http://creativecommons.org/licenses/by/3.0/ Method by Alex Wong (javapractices.com)


Method Summary
static java.util.List<java.io.File> getFileListing(java.io.File aStartingDir)
          Recursively walk a directory tree and return a List of all Files found; the List is sorted using File.compareTo().
static void main(java.lang.String... aArgs)
          Demonstrate use.
static void recursiveDeleteDir(java.io.File dir)
          Recursively delete a directory and all its children.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String... aArgs)
                 throws java.io.FileNotFoundException
Demonstrate use.

Parameters:
aArgs - - aArgs[0] is the full name of an existing directory that can be read.
Throws:
java.io.FileNotFoundException

getFileListing

public static java.util.List<java.io.File> getFileListing(java.io.File aStartingDir)
                                                   throws java.io.FileNotFoundException
Recursively walk a directory tree and return a List of all Files found; the List is sorted using File.compareTo().

Parameters:
aStartingDir - is a valid directory, which can be read.
Throws:
java.io.FileNotFoundException

recursiveDeleteDir

public static void recursiveDeleteDir(java.io.File dir)
                               throws java.io.IOException
Recursively delete a directory and all its children.

Parameters:
dir - is a valid directory.
Throws:
java.io.IOException


Copyright © 2010 Cloudera, Inc.