You can use the command line bin/Hadoop fs-rm (r) to delete files (folders) on hdfs)
You can also use HDFS APIs. As follows:
Import java.net. URI;
Import org. apache. hadoop. conf. Configuration;
Import org. apache. hadoop. fs. FileSystem;
Import org. apache. hadoop. fs. Path;
Public class FileDelete
{
Public static void main (String [] args) throws Exception
{
If (args. length! = 1 ){
System. out. println ("Usage filedelete <target> ");
System. exit (1 );
}
Configuration conf = new Configuration ();
FileSystem hdfs = FileSystem. get (URI. create (args [0]), conf );
Hdfs. delete (new Path (args [0]), false );
}
}
Copy local files to HDFS
Download files from HDFS to local
Upload local files to HDFS
Common commands for HDFS basic files
Introduction to HDFS and MapReduce nodes in Hadoop
Hadoop practice Chinese version + English version + Source Code [PDF]
Hadoop: The Definitive Guide (PDF]