private void processFileAction() throws IOException {
switch (fileAction.toLowerCase()) {
case "delete":
    fs.delete(file,true);
  break;
case "move":
Path targetFileMovePath=new Path(targetFolder,file.getName());
fs.rename(file,targetFileMovePath);
break;
case "archive":
try (FSDataOutputStream archivedStream=fs.create(new Path(targetFolder,file.getName() + ".zip"));ZipOutputStream zipArchivedStream=new ZipOutputStream(archivedStream);FSDataInputStream fdDataInputStream=fs.open(file)){
zipArchivedStream.putNextEntry(new ZipEntry(file.getName()));
int length;
byte[] buffer=new byte[1024];
while ((length=fdDataInputStream.read(buffer)) > 0) {
zipArchivedStream.write(buffer,0,length);
}
zipArchivedStream.closeEntry();
}
 fs.delete(file,true);
break;
default :
break;
}
}

private void processFileAction ( ) throws IOException { switch ( fileAction . toLowerCase ( ) ) { case "delete" : fs . delete ( file , true ) ; break ; case "move" : Path targetFileMovePath = new Path ( targetFolder , file . getName ( ) ) ; fs . rename ( file , targetFileMovePath ) ; break ; case "archive" : try ( FSDataOutputStream archivedStream = fs . create ( new Path ( targetFolder , file . getName ( ) + ".zip" ) ) ; ZipOutputStream zipArchivedStream = new ZipOutputStream ( archivedStream ) ; FSDataInputStream fdDataInputStream = fs . open ( file ) ) { zipArchivedStream . putNextEntry ( new ZipEntry ( file . getName ( ) ) ) ; int length ; byte [ ] buffer = new byte [ 1024 ] ; while ( ( length = fdDataInputStream . read ( buffer ) ) > 0 ) { zipArchivedStream . write ( buffer , 0 , length ) ; } zipArchivedStream . closeEntry ( ) ; } fs . delete ( file , true ) ; break ; default : break ; } }
method to process file with actions ( delete , move , archive ) specified .
