org.apache.hadoop.dfs
Class DFSShell

java.lang.Object
  extended by org.apache.hadoop.util.ToolBase
      extended by org.apache.hadoop.dfs.DFSShell
All Implemented Interfaces:
Configurable, Tool
Direct Known Subclasses:
DFSAdmin

public class DFSShell
extends ToolBase

This class provides some DFS administrative access.

Author:
Mike Cafarella

Field Summary
 
Fields inherited from class org.apache.hadoop.util.ToolBase
conf
 
Constructor Summary
DFSShell()
           
 
Method Summary
 void copy(String srcf, String dstf, Configuration conf)
          Copy DFS files that match the file pattern srcf to a destination dfs file.
 void delete(String srcf, boolean recursive)
          Delete all files in DFS that match the file pattern srcf.
 void du(String src)
          Show the size of all files in DFS that match the file pattern src
 void init()
           
 void ls(String srcf, boolean recursive)
          Get a listing of all files in DFS that match the file pattern srcf.
static void main(String[] argv)
          main() has some simple utility methods
 void mkdir(String src)
          Create the given dir
 void printUsage(String cmd)
          Displays format of commands.
 void rename(String srcf, String dstf)
          Move DFS files that match the file pattern srcf to a destination dfs file.
 int run(String[] argv)
          run
 void setReplication(short newRep, String srcf, boolean recursive)
          Set the replication for files that match file pattern srcf if it's a directory and recursive is true, set replication for all the subdirs and those files too.
 
Methods inherited from class org.apache.hadoop.util.ToolBase
doMain, getConf, setConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DFSShell

public DFSShell()
Method Detail

init

public void init()
          throws IOException
Throws:
IOException

setReplication

public void setReplication(short newRep,
                           String srcf,
                           boolean recursive)
                    throws IOException
Set the replication for files that match file pattern srcf if it's a directory and recursive is true, set replication for all the subdirs and those files too.

Parameters:
newRep - new replication factor
srcf - a file pattern specifying source files
recursive - if need to set replication factor for files in subdirs
Throws:
IOException
See Also:
FileSystem.globPaths(Path)

ls

public void ls(String srcf,
               boolean recursive)
        throws IOException
Get a listing of all files in DFS that match the file pattern srcf.

Parameters:
srcf - a file pattern specifying source files
recursive - if need to list files in subdirs
Throws:
IOException
See Also:
FileSystem.globPaths(Path)

du

public void du(String src)
        throws IOException
Show the size of all files in DFS that match the file pattern src

Parameters:
src - a file pattern specifying source files
Throws:
IOException
See Also:
FileSystem.globPaths(Path)

mkdir

public void mkdir(String src)
           throws IOException
Create the given dir

Throws:
IOException

rename

public void rename(String srcf,
                   String dstf)
            throws IOException
Move DFS files that match the file pattern srcf to a destination dfs file. When moving mutiple files, the destination must be a directory. Otherwise, IOException is thrown.

Parameters:
srcf - a file pattern specifying source files
dstf - a destination local file/directory
Throws:
IOException
See Also:
FileSystem.globPaths(Path)

copy

public void copy(String srcf,
                 String dstf,
                 Configuration conf)
          throws IOException
Copy DFS files that match the file pattern srcf to a destination dfs file. When copying mutiple files, the destination must be a directory. Otherwise, IOException is thrown.

Parameters:
srcf - a file pattern specifying source files
dstf - a destination local file/directory
Throws:
IOException
See Also:
FileSystem.globPaths(Path)

delete

public void delete(String srcf,
                   boolean recursive)
            throws IOException
Delete all files in DFS that match the file pattern srcf.

Parameters:
srcf - a file pattern specifying source files
recursive - if need to delete subdirs
Throws:
IOException
See Also:
FileSystem.globPaths(Path)

printUsage

public void printUsage(String cmd)
Displays format of commands.


run

public int run(String[] argv)
        throws Exception
run

Parameters:
argv - command specific arguments
Returns:
exit code
Throws:
Exception

main

public static void main(String[] argv)
                 throws Exception
main() has some simple utility methods

Throws:
Exception


Copyright © 2006 The Apache Software Foundation